Skip to content

Commit 3c1ea64

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

File tree

3 files changed

+11
-20
lines changed

3 files changed

+11
-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

+3-12
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ 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 { $ as zurk$, buildCmd, TShellResponse as TZurkShellResponse } from 'zurk'
2121
import {
2222
chalk,
2323
which,
@@ -106,17 +106,8 @@ export const $ = new Proxy<Shell & Options>(
106106
}
107107
let resolve: Resolve, reject: Resolve
108108
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-
}
109+
const cmd = buildCmd($.quote, pieces, args) as string
110+
120111
promise._bind(cmd, from, resolve!, reject!, getStore())
121112
// Postpone run to allow promise configuration.
122113
setImmediate(() => promise.isHalted || promise.run())

0 commit comments

Comments
 (0)