Skip to content

Commit

Permalink
jsc/wasm32/wasm32.jsc: new utility function
Browse files Browse the repository at this point in the history
  • Loading branch information
pipcet committed Feb 3, 2021
1 parent 7948de0 commit 936a467
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions jsc/wasm32/wasm32.jsc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ var path = args.shift();
args.unshift(os.getenv("EXECUTABLE"));
var remote;

function backtick(command)
{
let timestamp = Date.now();
try {
let pid = os.spawn(command);
let o = os.waitpid(pid);
let output = os.file.readFile("/tmp/tmp.out." + timestamp, "binary");
os.system("rm /tmp/tmp.out." + timestamp);
return output;
} catch (e) {
console.log("OH NO!");
console.log(e);
}
}

function CStringAt(heap, offset)
{
var ret = '';
Expand Down

0 comments on commit 936a467

Please sign in to comment.