aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-06-02 20:56:07 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-06-02 20:56:07 -0700
commite94f8f736b347d23d714f3b07cd44629f5b1ab93 (patch)
tree17e4b3c22a8589ad5fa05794c46b57346f859530
parent79e6d4c8d0fbd7068b41e4ad1b149d574237c756 (diff)
create /dev/null; issue #1226
-rw-r--r--src/library.js1
-rw-r--r--tests/files.cpp3
2 files changed, 4 insertions, 0 deletions
diff --git a/src/library.js b/src/library.js
index e65754ba..51c4c5cb 100644
--- a/src/library.js
+++ b/src/library.js
@@ -560,6 +560,7 @@ LibraryManager.library = {
var stdout = FS.createDevice(devFolder, 'stdout', null, output);
var stderr = FS.createDevice(devFolder, 'stderr', null, error);
FS.createDevice(devFolder, 'tty', input, output);
+ FS.createDevice(devFolder, 'null', function(){}, function(){});
// Create default streams.
FS.streams[1] = {
diff --git a/tests/files.cpp b/tests/files.cpp
index 04baa151..176cdb62 100644
--- a/tests/files.cpp
+++ b/tests/files.cpp
@@ -56,6 +56,9 @@ int main()
fwrite(data, 1, 5, outf);
fclose(outf);
+ FILE *devNull = fopen("/dev/null", "rb");
+ assert(devNull);
+
char data2[10];
FILE *inf = fopen("go.out", "rb");
int num = fread(data2, 1, 10, inf);