mirror of https://github.com/lukechilds/node.git
Browse Source
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>v4.0.0-rc
Fedor Indutny
10 years ago
committed by
Rod Vagg
4 changed files with 57 additions and 19 deletions
@ -0,0 +1,26 @@ |
|||||
|
'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'); |
||||
|
}); |
Loading…
Reference in new issue