-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
more process features #307
Comments
I think I'd rather have |
See a9fd119: if you want the success status, use the |
Silently swallowing command failure, brittle string interpolation into command strings, and unnecessarily using the shell to spawn external pipelines are my three bugaboos with doing shell-like scripting from ruby and perl. With this, we've eliminated all three. |
Also noting that we need a more abstract interface for |
Yes, definitely. |
Edit: nevermind, i should just write |
Yep. The former can't actually work because |
This all works now: julia> using Base.FS
julia> readall("test.julia")
could not open file test.julia
in open at io.jl:277
in open at io.jl:297
in readall at io.jl:424
julia> open("test.julia",JL_O_WRONLY|JL_O_CREAT,0o644)
File("test.julia",true,11)
julia> fh=ans
File("test.julia",true,11)
julia> run(`echo Hello`>fh)
true
julia> close(fh)
File("test.julia",false,-1)
julia> run(`echo World`>>"test.julia")
true
julia> run("test.julia">`tee`)
Hello
World
true
julia> pipe=write_to(`tee`>STDOUT)[1]
NamedPipe(connected,0 bytes waiting)
julia> write(pipe,"Test\n")
no method write(NamedPipe,ASCIIString)
julia> print(pipe,"Test\n")
Test
julia> run(`doesnotexist`)
execvp(): No such file or directory
failed process: Process(`doesnotexist`, ProcessExited(-1)) [-1]
in pipeline_error at process.jl:385
in run at process.jl:374
julia> success(`false`)
false
julia> success(`true`)
true
julia> success(`echo DONT PRINT THIS`)
true |
Are the open() functions in base/io.jl now deprecated? |
No, but they will be soon (i.e. as soon as I'm done writing the new one). We're moving to an all-libuv stack for I/O. The great thing about the module system is that i can just develop this one without ever touching the old one and when it's ready write |
Fix Compat on master by updating walkdir
…#307) * Replace the slow slotname Dict with a counter ("age")-based mechanism Co-authored-by: "Kristoffer Carlsson" <[email protected]> * make assignment_counter an Int64 to prevent overflow
Things that are needed:
run(
echo Hello| fh)
run(fh |
sort -nr)
run(
echo Hello> "hello.txt")
run(
echo world>> "hello.txt")
run("/usr/share/dict/words" >
tr A-Z a-z)
spawn
for starting a process without blockingrun(cmd)
throw an error on failuresuccess(cmd)
to just test for success or failureThe text was updated successfully, but these errors were encountered: