@travetto/exec
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -11,3 +11,3 @@ { | ||
"dependencies": { | ||
"@travetto/base": "^0.4.0", | ||
"@travetto/base": "^0.4.1", | ||
"@types/generic-pool": "^3.1.4", | ||
@@ -31,4 +31,4 @@ "generic-pool": "^3.4.2" | ||
}, | ||
"version": "0.4.0", | ||
"gitHead": "813fb4f842f149bcaa28c2e055e81fc86221eae1" | ||
"version": "0.4.1", | ||
"gitHead": "56dcc5bc1e70d9e61208be4128108a9c4f974f3d" | ||
} |
import * as child_process from 'child_process'; | ||
import * as util from 'util'; | ||
import * as fs from 'fs'; | ||
@@ -7,3 +6,3 @@ import * as path from 'path'; | ||
import { Shutdown, ScanFs, ScanEntry, Env } from '@travetto/base'; | ||
import { Shutdown, ScanFs, ScanEntry, Env, FsUtil } from '@travetto/base'; | ||
@@ -13,5 +12,2 @@ import { CommonProcess, ExecutionResult } from './types'; | ||
const writeFile = util.promisify(fs.writeFile); | ||
const mkdir = util.promisify(fs.mkdir); | ||
const unlinkFile = util.promisify(fs.unlink); | ||
@@ -202,3 +198,3 @@ function exec(command: string, opts?: WithOpts<child_process.SpawnOptions>) { | ||
// Make temp dirs | ||
const mkdirAll = Object.keys(this.tempVolumes).map(x => mkdir(x).catch(e => { })); | ||
const mkdirAll = Object.keys(this.tempVolumes).map(x => FsUtil.mkdirpAsync(x).catch(e => { })); | ||
await Promise.all(mkdirAll); | ||
@@ -286,3 +282,3 @@ } | ||
.filter(filter) | ||
.map(x => unlinkFile(x.file) | ||
.map(x => FsUtil.unlinkAsync(x.file) | ||
.catch(e => { console.error(`Unable to delete ${e.file}`); })) | ||
@@ -317,3 +313,3 @@ ); | ||
const f = path.join(dir, name); | ||
await writeFile(f, content, { mode: '755' }); | ||
await FsUtil.writeFileAsync(f, content, { mode: '755' }); | ||
} | ||
@@ -320,0 +316,0 @@ } |
@@ -79,6 +79,7 @@ import { Env } from '@travetto/base'; | ||
listen(handler: (e: U, complete: Function) => any) { | ||
let fn: (e: U) => void; | ||
const kill = (e?: any) => { | ||
this.removeListener(fn); | ||
}; | ||
const fn = (e: U) => { | ||
fn = (e: U) => { | ||
if (Env.trace) { | ||
@@ -85,0 +86,0 @@ console.trace(process.pid, 'RECEIVING', e.type, e); |
@@ -12,3 +12,3 @@ import * as os from 'os'; | ||
constructor(private create: () => Promise<T>, opts?: Options) { | ||
constructor(create: () => Promise<T>, opts?: Options) { | ||
const args = { | ||
@@ -15,0 +15,0 @@ max: os.cpus().length - 1, |
31099
828
Updated@travetto/base@^0.4.1