Skip to content

Commit

Permalink
pipe end on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
maidh91 committed Jan 6, 2025
1 parent aaff4d4 commit 4423d5b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion run.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,17 @@ module.exports = async function run ({ ipc, args, cmdArgs, link, storage, detach

const worker = new Worker()
const pipe = worker.pipe()
if (pipe) {
if (pipe !== null) {
pipe.on('end', () => child.kill())
pipe.on('close', () => child.kill())
}

child.once('exit', (code) => {
stream.push({ tag: 'exit', data: { code } })
ipc.close()
if (pipe !== null) {
pipe.end()
}
})
if (!detach) {
child.stdout.on('data', (data) => { stream.push({ tag: 'stdout', data }) })
Expand Down

0 comments on commit 4423d5b

Please sign in to comment.