Fixed reading from STDIN.
authorVisa Kopu <visa@2general.com>
Thu, 29 Nov 2012 08:51:15 +0000 (10:51 +0200)
committerVisa Kopu <visa@2general.com>
Thu, 29 Nov 2012 08:51:15 +0000 (10:51 +0200)
bin/uglifyjs

index 1706629..d2fbdb1 100755 (executable)
@@ -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");