• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const assert = require('assert');
4const child_process = require('child_process');
5
6const p = child_process.spawn(process.execPath, [
7  '-e',
8  'vm = require("vm");' +
9      'context = vm.createContext({});' +
10      'try { vm.runInContext("throw new Error(\'boo\')", context); } ' +
11      'catch (e) { console.log(e.message); }',
12]);
13
14p.stderr.on('data', common.mustNotCall());
15
16let output = '';
17
18p.stdout.on('data', (data) => output += data);
19
20p.stdout.on('end', common.mustCall(() => {
21  assert.strictEqual(output.replace(/[\r\n]+/g, ''), 'boo');
22}));
23