Skip to content

Commit a52d786

Browse files
authored
Merge pull request #219 from mohd-akram/fix-debug
Fix exception not printed when debugging
2 parents 0270596 + 8c7a838 commit a52d786

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

source-map-support.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,17 @@ function getErrorSource(error) {
430430
function printErrorAndExit (error) {
431431
var source = getErrorSource(error);
432432

433+
// Ensure error is printed synchronously and not truncated
434+
if (process.stderr._handle && process.stderr._handle.setBlocking) {
435+
process.stderr._handle.setBlocking(true);
436+
}
437+
433438
if (source) {
434-
fs.writeSync(2, "\n" + source + "\n");
439+
console.error();
440+
console.error(source);
435441
}
436442

437-
fs.writeSync(2, error.stack + "\n");
443+
console.error(error.stack);
438444
process.exit(1);
439445
}
440446

0 commit comments

Comments
 (0)