diff options
author | Mihai Bazon <mihai.bazon@gmail.com> | 2012-11-29 01:23:07 -0800 |
---|---|---|
committer | Mihai Bazon <mihai.bazon@gmail.com> | 2012-11-29 01:23:07 -0800 |
commit | f427e5efc76d7871d57f1f04b896254b4a872a86 (patch) | |
tree | 735e41175ad6639095643df9c2264e9602c4a0b9 /bin | |
parent | 13c4dfcabdd3e8597db6ecb09e2ac95fbae19195 (diff) | |
parent | e48802ad291fae5a16f2d23cbd25a0c433cdbe48 (diff) | |
download | tracifyjs-f427e5efc76d7871d57f1f04b896254b4a872a86.tar.gz tracifyjs-f427e5efc76d7871d57f1f04b896254b4a872a86.zip |
Merge pull request #58 from roxeteer/master
Fixed reading from STDIN
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/uglifyjs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs index 1706629c..d2fbdb18 100755 --- a/bin/uglifyjs +++ b/bin/uglifyjs @@ -335,9 +335,8 @@ function getOptions(x, constants) { function read_whole_file(filename) { if (filename == "-") { - // XXX: this sucks. How does one read the whole STDIN - // synchronously? - filename = "/dev/stdin"; + var size = fs.fstatSync(process.stdin.fd).size; + return size > 0 ? fs.readSync(process.stdin.fd, size)[0] : ""; } try { return fs.readFileSync(filename, "utf8"); |