Skip to content

Commit 206ca28

Browse files
authored
Make stdout available on error
When the process exits with an error, include the stdout output as well as the error. This makes debugging script failures more straightforward since the rest of the output is available. For example: print('hello world') raise Exception('goodbye world') callback() will now receive both "goodbye world" error, and the "hello world" output.
1 parent f523170 commit 206ca28

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,7 @@ export class PythonShell extends EventEmitter{
284284
return pyshell.on('message', function (message) {
285285
output.push(message);
286286
}).end(function (err) {
287-
if (err) return callback(err);
288-
return callback(null, output.length ? output : null);
287+
return callback(err? err : null, output.length ? output : null);
289288
});
290289
};
291290

0 commit comments

Comments
 (0)