Skip to content

Commit

Permalink
Don't forget stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
caub committed Aug 28, 2019
1 parent b4575b7 commit 4f4e687
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/plugins/js-eval/__tests__/jsEvalPlugin-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ describe('jsEvalPlugin', () => {

const output2 = await testEval('n> setTimeout(() => console.log(2), 1000); 1');
expect(output2).toEqual('(okay) 12');

const output3 = await testEval('n> console.warn("test")');
expect(output3).toEqual(`(okay) test\nundefined`);
});

it(`errors when it should`, async () => {
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/js-eval/jsEval.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ const jsEval = (code, environment = 'node-cjs', timeout = 5000, cmd = []) => new
data += chunk;
});

proc.stderr.on('data', (chunk) => {
data += chunk;
});

proc.on('error', (e) => {
clearTimeout(timer);
reject(e);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/js-eval/jsEvalPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const helpMsg = `n> node stable, h> node harmony, b> babel, s> node vm.Script, m

// default jseval run command
const CMD = ['node', '--no-warnings', '/run/run.js'];
const CMD_SHIMS = ['node', '-r', '/run/node_modules/airbnb-js-shims/target/es2019', '/run/run.js'];
const CMD_SHIMS = ['node', '-r', '/run/node_modules/airbnb-js-shims/target/es2019', '--no-warnings', '/run/run.js'];
const CMD_HARMONY = ['node', '--harmony', '--experimental-vm-modules', '--experimental-modules', '--no-warnings', '/run/run.js'];

const jsEvalPlugin = async ({ mentionUser, respond, message, selfConfig = {} }) => {
Expand Down

0 comments on commit 4f4e687

Please sign in to comment.