diff --git a/source-map-support.js b/source-map-support.js index 96083d5..fd3cf7e 100644 --- a/source-map-support.js +++ b/source-map-support.js @@ -430,11 +430,17 @@ function getErrorSource(error) { function printErrorAndExit (error) { var source = getErrorSource(error); + // Ensure error is printed synchronously and not truncated + if (process.stderr._handle && process.stderr._handle.setBlocking) { + process.stderr._handle.setBlocking(true); + } + if (source) { - fs.writeSync(2, "\n" + source + "\n"); + console.error(); + console.error(source); } - fs.writeSync(2, error.stack + "\n"); + console.error(error.stack); process.exit(1); }