diff options
author | Anthony Pesch <inolen@gmail.com> | 2013-07-18 00:12:02 -0700 |
---|---|---|
committer | Anthony Pesch <inolen@gmail.com> | 2013-07-18 00:12:02 -0700 |
commit | 188ec73280543ed636f180fa8204df11c96269fb (patch) | |
tree | 82033635c92b95694fc962394c4dc6f1612b0f09 /src/library.js | |
parent | 475e72dc5539d9c59fc267927441a502c14a178f (diff) |
fixed stderr output to use printErr
Diffstat (limited to 'src/library.js')
-rw-r--r-- | src/library.js | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/library.js b/src/library.js index f6da38c1..5e58f011 100644 --- a/src/library.js +++ b/src/library.js @@ -559,25 +559,28 @@ LibraryManager.library = { }; } var utf8 = new Runtime.UTF8Processor(); - function simpleOutput(val) { - if (val === null || val === {{{ charCode('\n') }}}) { - output.printer(output.buffer.join('')); - output.buffer = []; - } else { - output.buffer.push(utf8.processCChar(val)); - } + function createSimpleOutput() { + var fn = function (val) { + if (val === null || val === {{{ charCode('\n') }}}) { + fn.printer(fn.buffer.join('')); + fn.buffer = []; + } else { + fn.buffer.push(utf8.processCChar(val)); + } + }; + return fn; } if (!output) { stdoutOverridden = false; - output = simpleOutput; + output = createSimpleOutput(); } if (!output.printer) output.printer = Module['print']; if (!output.buffer) output.buffer = []; if (!error) { stderrOverridden = false; - error = simpleOutput; + error = createSimpleOutput(); } - if (!error.printer) error.printer = Module['print']; + if (!error.printer) error.printer = Module['printErr']; if (!error.buffer) error.buffer = []; // Create the temporary folder, if not already created |