@travetto/exec
Advanced tools
Comparing version 0.0.26 to 0.0.27
@@ -17,3 +17,3 @@ { | ||
}, | ||
"version": "0.0.26" | ||
"version": "0.0.27" | ||
} |
import * as cp from 'child_process'; | ||
import { ExecutionOptions, ExecutionResult } from './types'; | ||
import { scanDir, Entry } from '@travetto/base'; | ||
import { scanDir, Entry, BaseError } from '@travetto/base'; | ||
export function enhanceProcess(p: cp.ChildProcess, options: ExecutionOptions) { | ||
export function enhanceProcess(p: cp.ChildProcess, options: ExecutionOptions, cmd: string) { | ||
const timeout = options.timeout; | ||
@@ -23,3 +23,3 @@ | ||
if (!result.valid) { | ||
reject(result); | ||
reject(new BaseError(`Error executing ${cmd}: ${result.message || 'failed'}`, result)); | ||
} else { | ||
@@ -72,3 +72,3 @@ resolve(result); | ||
const p = cp.spawn(cmd, args, { shell: true, ...(options as cp.SpawnOptions) }); | ||
return [p, enhanceProcess(p, options)]; | ||
return [p, enhanceProcess(p, options, cmdStr)]; | ||
} | ||
@@ -79,3 +79,3 @@ | ||
const p = cp.fork(cmd, args, options); | ||
return [p, enhanceProcess(p, options)]; | ||
return [p, enhanceProcess(p, options, cmdStr)]; | ||
} | ||
@@ -85,3 +85,3 @@ | ||
const p = cp.exec(cmd, options); | ||
return [p, enhanceProcess(p, options)]; | ||
return [p, enhanceProcess(p, options, cmd)]; | ||
} | ||
@@ -88,0 +88,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20963