diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-07-22 11:10:40 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-07-22 11:10:40 -0700 |
commit | f5d05aa2e38fdbba2450c4f8eb064b741d1b4176 (patch) | |
tree | a88bff429e133602107d7702c82d567303b304b2 /src/library.js | |
parent | 67b321c1617bd65bf9f24702676c2fdf51e51bb4 (diff) | |
parent | 188ec73280543ed636f180fa8204df11c96269fb (diff) |
Merge pull request #1406 from inolen/printerr_fixes
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 a41c8105..22cc053e 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 |