diff --git a/src/node/jsShell.ts b/src/node/jsShell.ts index 822520b..9446090 100644 --- a/src/node/jsShell.ts +++ b/src/node/jsShell.ts @@ -19,9 +19,22 @@ interface Options { } export function jsShell( commander: T, - options: Options = {}, + options: Options | 'inherit' | 'pipe' = 'inherit', ) { - const { args = [], stdio = 'inherit', errorExit, isLog, cwd } = options + let args: string[] = [] + let stdio: 'inherit' | 'pipe' = 'inherit' + let errorExit: boolean = true + let isLog: boolean = false + let cwd: string | undefined + if (typeof options === 'string') { + stdio = options + } else { + args = options.args || [] + stdio = options.stdio || 'inherit' + errorExit = options.errorExit || true + isLog = options.isLog || false + cwd = options.cwd + } return ( isArray(commander) diff --git a/src/worker/useNodeWorkerThread.ts b/src/worker/useNodeWorkerThread.ts index 431ce72..7dc954d 100644 --- a/src/worker/useNodeWorkerThread.ts +++ b/src/worker/useNodeWorkerThread.ts @@ -4,5 +4,5 @@ import { jsShell } from '../node/jsShell' useProcressNodeWorker( ({ params, stdio = 'pipe', errorExit, isLog }: NodeWorkerPayload) => - jsShell(`${params}`, stdio, errorExit, isLog), + jsShell(`${params}`, { stdio, errorExit, isLog }), )