Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-He95 committed Feb 25, 2024
1 parent 084b859 commit d404694
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions src/node/jsShell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,22 @@ interface Options {
}
export function jsShell<T extends string | string[]>(
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)
Expand Down
2 changes: 1 addition & 1 deletion src/worker/useNodeWorkerThread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
)

0 comments on commit d404694

Please sign in to comment.