mirror of
https://github.com/pnpm/pnpm.git
synced 2026-02-02 19:22:52 -05:00
fix(exec): wait for the child process to close
This commit is contained in:
5
.changeset/good-ideas-yawn.md
Normal file
5
.changeset/good-ideas-yawn.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-script-runners": patch
|
||||
---
|
||||
|
||||
Fix waiting for closed child process.
|
||||
@@ -281,11 +281,14 @@ export async function handler (
|
||||
}
|
||||
child.stdout!.on('data', logFn('stdout'))
|
||||
child.stderr!.on('data', logFn('stderr'))
|
||||
void child.once('close', exitCode => {
|
||||
lifecycleLogger.debug({
|
||||
...lifecycleOpts,
|
||||
exitCode: exitCode ?? 1,
|
||||
optional: false,
|
||||
await new Promise<void>((resolve) => {
|
||||
void child.once('close', exitCode => {
|
||||
lifecycleLogger.debug({
|
||||
...lifecycleOpts,
|
||||
exitCode: exitCode ?? 1,
|
||||
optional: false,
|
||||
})
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
await child
|
||||
|
||||
Reference in New Issue
Block a user