nk-cli
Version:
Initialize a vite app fast by NK-CLI
17 lines (14 loc) • 465 B
text/typescript
import { spawn, StdioOptions } from 'child_process';
function createSpawnCmd(dest: string, stdio: StdioOptions = 'inherit') {
return function (cmd: string, args?: string[]): Promise<boolean> {
const ls = spawn(cmd, args, {
cwd: dest,
stdio: stdio,
shell: true
});
return new Promise((resolve, reject) => {
ls.on('close', (code) => { code === 0 ? resolve(true) : reject(false) });
})
};
}
export default createSpawnCmd;