mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 18:29:01 +00:00

Put the `...^` arrow string to the hidden property of the object, and use it only when printing error to the stderr. Fix: https://github.com/nodejs/io.js/issues/2104 PR-URL: https://github.com/nodejs/io.js/pull/2108 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
27 lines
639 B
JavaScript
27 lines
639 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var child_process = require('child_process');
|
|
|
|
var p = child_process.spawn(process.execPath, [
|
|
'-e',
|
|
'vm = require("vm");' +
|
|
'context = vm.createContext({});' +
|
|
'try { vm.runInContext("throw new Error(\'boo\')", context); } ' +
|
|
'catch (e) { console.log(e.message); }'
|
|
]);
|
|
|
|
p.stderr.on('data', function(data) {
|
|
assert(false, 'Unexpected stderr data: ' + data);
|
|
});
|
|
|
|
var output = '';
|
|
|
|
p.stdout.on('data', function(data) {
|
|
output += data;
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(output.replace(/[\r\n]+/g, ''), 'boo');
|
|
});
|