Output both stderr and stdout
This commit is contained in:
parent
6bf880a289
commit
bc67dbbfd7
2 changed files with 8 additions and 13 deletions
|
@ -155,15 +155,16 @@ class LanguageHandler extends AkairoHandler {
|
|||
}, timeout);
|
||||
}
|
||||
|
||||
let stdout = '';
|
||||
let stderr = '';
|
||||
let output = '';
|
||||
let hasStderr = false;
|
||||
let error;
|
||||
proc.stdout.on('data', chunk => {
|
||||
stdout += chunk;
|
||||
output += chunk;
|
||||
});
|
||||
|
||||
proc.stderr.on('data', chunk => {
|
||||
stderr += chunk;
|
||||
hasStderr = true;
|
||||
output += chunk;
|
||||
});
|
||||
|
||||
proc.on('error', e => {
|
||||
|
@ -175,12 +176,12 @@ class LanguageHandler extends AkairoHandler {
|
|||
handled = true;
|
||||
if (status !== 0 || error) {
|
||||
if (!error) {
|
||||
error = new Error(stderr || 'Something went wrong');
|
||||
error = new Error(output || 'Something went wrong');
|
||||
}
|
||||
|
||||
reject(error);
|
||||
} else {
|
||||
resolve({ stdout, stderr });
|
||||
resolve({ output, hasStderr });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue