aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-03-10 20:48:17 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-03-10 20:48:17 -0800
commit551c2c8c863d76ccecdd0247a7d523dcd87dc993 (patch)
treef63a487c14e3af76e1044c3c8bc09eb34e58dbe8 /src/library.js
parentdd4467670787af2a81b304c6cadfab662c8f12e6 (diff)
be careful when flushing streams that may have been closed, during shutdown
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/library.js b/src/library.js
index 4d90fa05..407aa8c3 100644
--- a/src/library.js
+++ b/src/library.js
@@ -421,9 +421,9 @@ LibraryManager.library = {
quit: function() {
if (!FS.init.initialized) return;
- // Flush any partially-printed lines in stdout and stderr
- if (FS.streams[2].object.output.buffer.length > 0) FS.streams[2].object.output('\n'.charCodeAt(0));
- if (FS.streams[3].object.output.buffer.length > 0) FS.streams[3].object.output('\n'.charCodeAt(0));
+ // Flush any partially-printed lines in stdout and stderr. Careful, they may have been closed
+ if (FS.streams[2] && FS.streams[2].object.output.buffer.length > 0) FS.streams[2].object.output('\n'.charCodeAt(0));
+ if (FS.streams[3] && FS.streams[3].object.output.buffer.length > 0) FS.streams[3].object.output('\n'.charCodeAt(0));
}
},