Created
April 26, 2010 20:29
-
-
Save paulbaumgart/379859 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Work-around for OS.command that isn't compatible with narwhal-jsc. | |
// This should be removed if a fix is merged into the mainline narwhal-jsc. | |
try | |
{ | |
OS.command(""); | |
} | |
catch (e) | |
{ | |
OS.command = function(command) | |
{ | |
var newCommand = command + " 2>/dev/null", | |
process = OS.popen(newCommand), | |
results = [], | |
tmpResult; | |
do | |
{ | |
tmpResult = process.stdout.read(); | |
results.push(tmpResult); | |
} | |
while (tmpResult !== ""); | |
var status = process.wait(); | |
if (status !== 0) | |
throw new Error("command: \"" + command + "\" returned status: " + status); | |
return results.join(""); | |
}; | |
} | |
try | |
{ | |
print(OS.command("false")); | |
} | |
catch (e) | |
{ | |
print(e); | |
} | |
print(OS.command("for i in {1..10000}; do echo $i; done;")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment