Skip to content

Commit 0dc5973

Browse files
committed
chore: minor imprs
1 parent c94aabd commit 0dc5973

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/core.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export interface Shell<
145145
(opts: Partial<Omit<Options, 'sync'>>): Shell<true>
146146
}
147147
}
148-
const bound: [boolean, string, string, Options][] = []
148+
const bound: [string, string, Options][] = []
149149

150150
export const $: Shell & Options = new Proxy<Shell & Options>(
151151
function (pieces: TemplateStringsArray | Partial<Options>, ...args: any) {
@@ -171,7 +171,7 @@ export const $: Shell & Options = new Proxy<Shell & Options>(
171171
args
172172
) as string
173173
const sync = snapshot[SYNC]
174-
bound.push([sync, cmd, from, snapshot])
174+
bound.push([cmd, from, snapshot])
175175
const process = new ProcessPromise(noop)
176176

177177
if (!process.isHalted() || sync) process.run()
@@ -235,14 +235,14 @@ export class ProcessPromise extends Promise<ProcessOutput> {
235235
executor?.(...args)
236236
})
237237

238-
if (executor === noop) {
239-
const [sync, cmd, from, snapshot] = bound.pop()!
238+
if (bound.length) {
239+
const [cmd, from, snapshot] = bound.pop()!
240240
this._command = cmd
241241
this._from = from
242242
this._resolve = resolve!
243243
this._reject = (v: ProcessOutput) => {
244244
reject!(v)
245-
if (sync) throw v
245+
if (snapshot[SYNC]) throw v
246246
}
247247
this._snapshot = { ac: new AbortController(), ...snapshot }
248248
if (this._snapshot.halt) this._stage = 'halted'

test/core.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ describe('core', () => {
456456

457457
it('all transitions', async () => {
458458
const { promise, resolve, reject } = Promise.withResolvers()
459-
const p = new ProcessPromise(() => {})
459+
const p = new ProcessPromise(noop)
460460
ProcessPromise.disarm(p, false)
461461
assert.equal(p.stage, 'initial')
462462

0 commit comments

Comments
 (0)