Merge pull request #58 from roxeteer/master

Fixed reading from STDIN
This commit is contained in:
Mihai Bazon 2012-11-29 01:23:07 -08:00
commit f427e5efc7

View File

@ -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");