Created
September 5, 2020 05:36
-
-
Save singularitti/b7a0630678db8c800458a8bce0edde0e to your computer and use it in GitHub Desktop.
Execute shell commands in Julia wrapper #Julia
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
# From https://discourse.julialang.org/t/better-support-for-running-external-commands/44933/26 | |
function execute(cmd::Cmd) | |
out = Pipe() | |
err = Pipe() | |
process = run(pipeline(ignorestatus(cmd), stdout = out, stderr = err)) | |
close(out.in) | |
close(err.in) | |
stdout = @async String(read(out)) | |
stderr = @async String(read(err)) | |
wait(process) | |
return ( | |
stdout = fetch(stdout), | |
stderr = fetch(stderr), | |
code = process.exitcode, | |
) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment