Skip to content

Instantly share code, notes, and snippets.

@PhilHudson
Created April 9, 2015 11:52
Show Gist options
  • Save PhilHudson/b5a1b9b8aed2591de058 to your computer and use it in GitHub Desktop.
Save PhilHudson/b5a1b9b8aed2591de058 to your computer and use it in GitHub Desktop.
Failing attempt to get shell command output in Conkeror
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