Skip to content

Commit d404694

Browse files
committed
chore: update
1 parent 084b859 commit d404694

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/node/jsShell.ts

+15-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,22 @@ interface Options {
1919
}
2020
export function jsShell<T extends string | string[]>(
2121
commander: T,
22-
options: Options = {},
22+
options: Options | 'inherit' | 'pipe' = 'inherit',
2323
) {
24-
const { args = [], stdio = 'inherit', errorExit, isLog, cwd } = options
24+
let args: string[] = []
25+
let stdio: 'inherit' | 'pipe' = 'inherit'
26+
let errorExit: boolean = true
27+
let isLog: boolean = false
28+
let cwd: string | undefined
29+
if (typeof options === 'string') {
30+
stdio = options
31+
} else {
32+
args = options.args || []
33+
stdio = options.stdio || 'inherit'
34+
errorExit = options.errorExit || true
35+
isLog = options.isLog || false
36+
cwd = options.cwd
37+
}
2538

2639
return (
2740
isArray(commander)

src/worker/useNodeWorkerThread.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import { jsShell } from '../node/jsShell'
44

55
useProcressNodeWorker(
66
({ params, stdio = 'pipe', errorExit, isLog }: NodeWorkerPayload) =>
7-
jsShell(`${params}`, stdio, errorExit, isLog),
7+
jsShell(`${params}`, { stdio, errorExit, isLog }),
88
)

0 commit comments

Comments
 (0)