Skip to content

Commit 38dfde3

Browse files
committed
Rethrow catch in spawn
1 parent 4ce2a95 commit 38dfde3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

registry/lib/spawn.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
const { stripAnsi } = /*@__PURE__*/ require('./strings')
44

5+
const { keys: ObjectKeys } = Object
6+
57
let _child_process
68
/*@__NO_SIDE_EFFECTS__*/
79
function getChildProcess() {
@@ -84,18 +86,18 @@ function spawn(cmd, args, options, extra) {
8486
)
8587
const oldSpawnPromise = spawnPromise
8688
if (shouldStripAnsi && stdioString) {
87-
spawnPromise = spawnPromise
88-
.then(stripAnsiFromSpawnResult)
89-
.catch(stripAnsiFromSpawnResult)
89+
spawnPromise = spawnPromise.then(stripAnsiFromSpawnResult).catch(error => {
90+
throw stripAnsiFromSpawnResult(error)
91+
})
9092
}
9193
if (shouldPauseSpinner) {
9294
spawnPromise = spawnPromise.finally(() => {
9395
spinner.start()
9496
})
9597
}
96-
spawnPromise.process = oldSpawnPromise.process
97-
spawnPromise.stdin = oldSpawnPromise.stdin
98-
98+
for (const key of ObjectKeys(oldSpawnPromise)) {
99+
spawnPromise[key] = oldSpawnPromise[key]
100+
}
99101
return spawnPromise
100102
}
101103

0 commit comments

Comments
 (0)