Skip to content

Commit 5875929

Browse files
committed
chore: use buildCmd from zurk
1 parent 98a0e66 commit 5875929

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@
100100
"author": "Anton Medvedev <anton@medv.io>",
101101
"license": "Apache-2.0",
102102
"dependencies": {
103-
"zurk": "^0.0.9"
103+
"zurk": "^0.0.11"
104104
}
105105
}

src/core.ts

+7-12
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ import { ChildProcess, spawn, StdioNull, StdioPipe } from 'node:child_process'
1717
import { AsyncLocalStorage, createHook } from 'node:async_hooks'
1818
import { Readable, Writable } from 'node:stream'
1919
import { inspect } from 'node:util'
20-
import { $ as zurk$, TShellResponse as TZurkShellResponse } from 'zurk'
20+
import {
21+
$ as zurk$,
22+
buildCmd,
23+
TShellResponse as TZurkShellResponse,
24+
} from 'zurk'
2125
import {
2226
chalk,
2327
which,
@@ -106,17 +110,8 @@ export const $ = new Proxy<Shell & Options>(
106110
}
107111
let resolve: Resolve, reject: Resolve
108112
const promise = new ProcessPromise((...args) => ([resolve, reject] = args))
109-
let cmd = pieces[0],
110-
i = 0
111-
while (i < args.length) {
112-
let s
113-
if (Array.isArray(args[i])) {
114-
s = args[i].map((x: any) => $.quote(substitute(x))).join(' ')
115-
} else {
116-
s = $.quote(substitute(args[i]))
117-
}
118-
cmd += s + pieces[++i]
119-
}
113+
const cmd = buildCmd($.quote, pieces, args) as string
114+
120115
promise._bind(cmd, from, resolve!, reject!, getStore())
121116
// Postpone run to allow promise configuration.
122117
setImmediate(() => promise.isHalted || promise.run())

0 commit comments

Comments
 (0)