Skip to content

Commit a2e6f47

Browse files
committed
fix(spawnify) child.std: add error handlers
1 parent a77c87e commit a2e6f47

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

lib/spawnify.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@
101101
};
102102

103103
Spawnify.prototype._set = function set(type, command, options) {
104-
var args, error, child;
104+
var args, error, child,
105+
self = this;
105106

106107
check(arguments, ['type', 'command', 'options']);
107108

@@ -159,14 +160,26 @@
159160

160161
check(arguments, ['child']);
161162

163+
child.stdin.on('error', function(error) {
164+
self._emit('error', newLine(error));
165+
});
166+
162167
child.stdout.on('data', function(data) {
163168
self._emit('data', data);
164169
});
165170

171+
child.stdout.on('error', function(error) {
172+
self._emit('error', newLine(error));
173+
});
174+
166175
child.stderr.on('data', function(error) {
167176
self._emit('error', Error(error));
168177
});
169178

179+
child.stderr.on('error', function(error) {
180+
self._emit('error', newLine(error));
181+
});
182+
170183
child.on('error', function(error) {
171184
self._emit('error', newLine(error));
172185
});

0 commit comments

Comments
 (0)