Created
September 4, 2010 02:04
-
-
Save paulbaumgart/564819 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
| var OS = require("os"); | |
| 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(""); | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hacker narwhal