smartspawn/ts/smartspawn.wrap.ts

19 lines
403 B
TypeScript
Raw Normal View History

2018-08-02 13:31:05 +00:00
import * as spawnWrap from 'spawn-wrap';
let unwrap: any = null;
export const startSpawnWrap = (filePath: string, cliArgs: string[] = [], envArgs: any = {}) => {
2019-08-22 07:26:30 +00:00
const spawnArray = [filePath];
for (const cliArg of cliArgs) {
2018-08-02 13:31:05 +00:00
spawnArray.push(cliArg);
}
unwrap = spawnWrap(spawnArray, envArgs);
};
export const endSpawnWrap = () => {
if (unwrap) {
unwrap();
unwrap = null;
}
};