Created
April 9, 2015 11:52
-
-
Save PhilHudson/b5a1b9b8aed2591de058 to your computer and use it in GitHub Desktop.
Failing attempt to get shell command output in Conkeror
This file contains 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
function shell_command_output (command) { | |
var error_text = ""; | |
var output_text = ""; | |
var exit_status = shell_command( | |
command, | |
$fds = [ | |
{ | |
output: | |
async_binary_string_writer("") | |
}, | |
{ | |
input: | |
async_binary_reader( | |
function (s) { | |
output_text += s || ""; | |
} | |
) | |
}, | |
{ | |
input: | |
async_binary_reader( | |
function (s) { | |
error_text += s || ""; | |
} | |
) | |
} | |
] | |
); | |
if (exit_status != 0 ) { | |
throw new Error("exit_status: " + exit_status + ", error_text: " + | |
error_text); | |
} | |
return output_text.trim(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment