Skip to content

Commit

Permalink
gracefully handle quitting after stdout closes (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Dickey authored Jul 19, 2016
1 parent 4b7e305 commit 4449602
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,13 @@ ctx.version = ctx.version + ' ' + pluginName + '/' + pluginVersion + ' node-' +
if (command === '') { command = null }
let plugin = require(pluginName)
let cmd = plugin.commands.filter((c) => c.topic === topic && c.command == command)[0]
function handleEPIPE (err) {
if (err.errno !== 'EPIPE') throw err
}
process.stdout.on('error', handleEPIPE)
process.stderr.on('error', handleEPIPE)
cmd.run(ctx)
`, args, plugin.Name, plugin.Version, topic, command, ctxJSON)

Expand Down

0 comments on commit 4449602

Please sign in to comment.