diff --git a/base/deprecated.jl b/base/deprecated.jl index 0c97fce868e664..d0c74cfeb7fb1d 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -207,16 +207,17 @@ const MemoryError = OutOfMemoryError #9295 @deprecate push!(t::Associative, key, v) setindex!(t, v, key) -@deprecate (|>)(src::AbstractCmd, dest::AbstractCmd) pipe(src, dest) -@deprecate (.>)(src::AbstractCmd, dest::AbstractCmd) pipe(src, stderr=dest) -@deprecate (|>)(src::Redirectable, dest::AbstractCmd) pipe(src, dest) -@deprecate (|>)(src::AbstractCmd, dest::Redirectable) pipe(src, dest) -@deprecate (.>)(src::AbstractCmd, dest::Redirectable) pipe(src, stderr=dest) -@deprecate (|>)(src::AbstractCmd, dest::AbstractString) pipe(src, dest) -@deprecate (|>)(src::AbstractString, dest::AbstractCmd) pipe(src, dest) -@deprecate (.>)(src::AbstractCmd, dest::AbstractString) pipe(src, stderr=dest) -@deprecate (>>)(src::AbstractCmd, dest::AbstractString) pipe(src, stdout=dest, append=true) -@deprecate (.>>)(src::AbstractCmd, dest::AbstractString) pipe(src, stderr=dest, append=true) +@deprecate (|>)(src::AbstractCmd, dest::AbstractCmd) pipeline(src, dest) +@deprecate (.>)(src::AbstractCmd, dest::AbstractCmd) pipeline(src, stderr=dest) +@deprecate (|>)(src::Redirectable, dest::AbstractCmd) pipeline(src, dest) +@deprecate (|>)(src::AbstractCmd, dest::Redirectable) pipeline(src, dest) +@deprecate (.>)(src::AbstractCmd, dest::Redirectable) pipeline(src, stderr=dest) +@deprecate (|>)(src::AbstractCmd, dest::AbstractString) pipeline(src, dest) +@deprecate (|>)(src::AbstractString, dest::AbstractCmd) pipeline(src, dest) +@deprecate (.>)(src::AbstractCmd, dest::AbstractString) pipeline(src, stderr=dest) +@deprecate (>>)(src::AbstractCmd, dest::AbstractString) pipeline(src, stdout=dest, append=true) +@deprecate (.>>)(src::AbstractCmd, dest::AbstractString) pipeline(src, stderr=dest, append=true) +@deprecate pipe pipeline # 10314 @deprecate filter!(r::Regex, d::Dict) filter!((k,v)->ismatch(r,k), d) diff --git a/base/exports.jl b/base/exports.jl index 6758ef4f812baa..941c0848d0f963 100644 --- a/base/exports.jl +++ b/base/exports.jl @@ -1147,7 +1147,7 @@ export nb_available, ntoh, open, - pipe, + pipeline, Pipe, PipeBuffer, poll_fd, diff --git a/base/interactiveutil.jl b/base/interactiveutil.jl index 3f4e70aeeed543..8faf759a5f31bf 100644 --- a/base/interactiveutil.jl +++ b/base/interactiveutil.jl @@ -85,7 +85,7 @@ end global _clipboardcmd _clipboardcmd !== nothing && return _clipboardcmd for cmd in (:xclip, :xsel) - success(pipe(`which $cmd`, DevNull)) && return _clipboardcmd = cmd + success(pipeline(`which $cmd`, DevNull)) && return _clipboardcmd = cmd end error("no clipboard command found, please install xsel or xclip") end @@ -163,7 +163,7 @@ function versioninfo(io::IO=STDOUT, verbose::Bool=false) println(io, " WORD_SIZE: ", Sys.WORD_SIZE) if verbose lsb = "" - @linux_only try lsb = readchomp(pipe(`lsb_release -ds`, stderr=DevNull)) end + @linux_only try lsb = readchomp(pipeline(`lsb_release -ds`, stderr=DevNull)) end @windows_only try lsb = strip(readall(`$(ENV["COMSPEC"]) /c ver`)) end if lsb != "" println(io, " ", lsb) @@ -341,7 +341,7 @@ downloadcmd = nothing global downloadcmd if downloadcmd === nothing for checkcmd in (:curl, :wget, :fetch) - if success(pipe(`which $checkcmd`, DevNull)) + if success(pipeline(`which $checkcmd`, DevNull)) downloadcmd = checkcmd break end diff --git a/base/pkg/entry.jl b/base/pkg/entry.jl index 5b57a98f680010..8bd580f456b398 100644 --- a/base/pkg/entry.jl +++ b/base/pkg/entry.jl @@ -55,7 +55,7 @@ function add(pkg::AbstractString, vers::VersionSet) outdated = :yes else try - run(pipe(Git.cmd(`fetch -q --all`, dir="METADATA"),stdout=DevNull,stderr=DevNull)) + run(pipeline(Git.cmd(`fetch -q --all`, dir="METADATA"),stdout=DevNull,stderr=DevNull)) outdated = Git.success(`diff --quiet origin/$branch`, dir="METADATA") ? (:no) : (:yes) end diff --git a/base/pkg/generate.jl b/base/pkg/generate.jl index c9a3c3305ddf8d..676b4f7c81e215 100644 --- a/base/pkg/generate.jl +++ b/base/pkg/generate.jl @@ -11,7 +11,7 @@ github_user() = readchomp(ignorestatus(`git config --global --get github.user`)) function git_contributors(dir::AbstractString, n::Int=typemax(Int)) contrib = Dict() tty = @windows? "CON:" : "/dev/tty" - for line in eachline(pipe(tty, Git.cmd(`shortlog -nes`, dir=dir))) + for line in eachline(pipeline(tty, Git.cmd(`shortlog -nes`, dir=dir))) m = match(r"\s*(\d+)\s+(.+?)\s+\<(.+?)\>\s*$", line) m == nothing && continue commits, name, email = m.captures diff --git a/base/pkg/git.jl b/base/pkg/git.jl index 8be26b94a48dc0..492c0077ddcd4c 100644 --- a/base/pkg/git.jl +++ b/base/pkg/git.jl @@ -21,7 +21,7 @@ function git(d) end cmd(args::Cmd; dir="") = `$(git(dir)) $args` -run(args::Cmd; dir="", out=STDOUT) = Base.run(pipe(cmd(args,dir=dir), out)) +run(args::Cmd; dir="", out=STDOUT) = Base.run(pipeline(cmd(args,dir=dir), out)) readall(args::Cmd; dir="") = Base.readall(cmd(args,dir=dir)) readchomp(args::Cmd; dir="") = Base.readchomp(cmd(args,dir=dir)) diff --git a/base/process.jl b/base/process.jl index 34af848d60b624..8d725a3d7657ca 100644 --- a/base/process.jl +++ b/base/process.jl @@ -50,7 +50,7 @@ function show(io::IO, cmd::Cmd) end function show(io::IO, cmds::Union{OrCmds,ErrOrCmds}) - print(io, "pipe(") + print(io, "pipeline(") show(io, cmds.a) print(io, ", ") print(io, isa(cmds, ErrOrCmds) ? "stderr=" : "stdout=") @@ -100,7 +100,7 @@ type CmdRedirect <: AbstractCmd end function show(io::IO, cr::CmdRedirect) - print(io, "pipe(") + print(io, "pipeline(") show(io, cr.cmd) print(io, ", ") if cr.stream_no == STDOUT_NO @@ -149,7 +149,7 @@ redir_err(src::AbstractCmd, dest::AbstractString) = CmdRedirect(src, FileRedirec redir_out_append(src::AbstractCmd, dest::AbstractString) = CmdRedirect(src, FileRedirect(dest, true), STDOUT_NO) redir_err_append(src::AbstractCmd, dest::AbstractString) = CmdRedirect(src, FileRedirect(dest, true), STDERR_NO) -function pipe(cmd::AbstractCmd; stdin=nothing, stdout=nothing, stderr=nothing, append::Bool=false) +function pipeline(cmd::AbstractCmd; stdin=nothing, stdout=nothing, stderr=nothing, append::Bool=false) if append && stdout === nothing && stderr === nothing error("append set to true, but no output redirections specified") end @@ -165,10 +165,10 @@ function pipe(cmd::AbstractCmd; stdin=nothing, stdout=nothing, stderr=nothing, a return cmd end -pipe(cmd::AbstractCmd, dest) = pipe(cmd, stdout=dest) -pipe(src::Union{Redirectable,AbstractString}, cmd::AbstractCmd) = pipe(cmd, stdin=src) +pipeline(cmd::AbstractCmd, dest) = pipeline(cmd, stdout=dest) +pipeline(src::Union{Redirectable,AbstractString}, cmd::AbstractCmd) = pipeline(cmd, stdin=src) -pipe(a, b, c, d...) = pipe(pipe(a,b), c, d...) +pipeline(a, b, c, d...) = pipeline(pipeline(a,b), c, d...) typealias RawOrBoxedHandle Union{UVHandle,AsyncStream,Redirectable,IOStream} typealias StdIOSet NTuple{3,RawOrBoxedHandle} diff --git a/base/random.jl b/base/random.jl index 1e562d5b50d1aa..2cbad685755bf5 100644 --- a/base/random.jl +++ b/base/random.jl @@ -131,7 +131,7 @@ function make_seed() seed = reinterpret(UInt64, time()) seed = hash(seed, UInt64(getpid())) try - seed = hash(seed, parse(UInt64, readall(pipe(`ifconfig`, `sha1sum`))[1:40], 16)) + seed = hash(seed, parse(UInt64, readall(pipeline(`ifconfig`, `sha1sum`))[1:40], 16)) end return make_seed(seed) end diff --git a/test/spawn.jl b/test/spawn.jl index 8e0351db04d6a3..cfc58f4a880c02 100644 --- a/test/spawn.jl +++ b/test/spawn.jl @@ -19,23 +19,23 @@ yes = `perl -le 'while (1) {print STDOUT "y"}'` #### Examples used in the manual #### @test readall(`echo hello | sort`) == "hello | sort\n" -@test readall(pipe(`echo hello`, `sort`)) == "hello\n" -@test length(spawn(pipe(`echo hello`, `sort`)).processes) == 2 +@test readall(pipeline(`echo hello`, `sort`)) == "hello\n" +@test length(spawn(pipeline(`echo hello`, `sort`)).processes) == 2 out = readall(`echo hello` & `echo world`) @test search(out,"world") != (0,0) @test search(out,"hello") != (0,0) -@test readall(pipe(`echo hello` & `echo world`, `sort`)) == "hello\nworld\n" +@test readall(pipeline(`echo hello` & `echo world`, `sort`)) == "hello\nworld\n" @test (run(`printf " \033[34m[stdio passthrough ok]\033[0m\n"`); true) # Test for SIGPIPE being treated as normal termination (throws an error if broken) -@unix_only @test (run(pipe(yes,`head`,DevNull)); true) +@unix_only @test (run(pipeline(yes,`head`,DevNull)); true) begin a = Base.Condition() @schedule begin - p = spawn(pipe(yes,DevNull)) + p = spawn(pipeline(yes,DevNull)) Base.notify(a,p) @test !success(p) end @@ -51,30 +51,30 @@ end if false prefixer(prefix, sleep) = `perl -nle '$|=1; print "'$prefix' ", $_; sleep '$sleep';'` - @test success(pipe(`perl -le '$|=1; for(0..2){ print; sleep 1 }'`, + @test success(pipeline(`perl -le '$|=1; for(0..2){ print; sleep 1 }'`, prefixer("A",2) & prefixer("B",2))) - @test success(pipe(`perl -le '$|=1; for(0..2){ print; sleep 1 }'`, + @test success(pipeline(`perl -le '$|=1; for(0..2){ print; sleep 1 }'`, prefixer("X",3) & prefixer("Y",3) & prefixer("Z",3), prefixer("A",2) & prefixer("B",2))) end @test success(`true`) @test !success(`false`) -@test success(pipe(`true`, `true`)) +@test success(pipeline(`true`, `true`)) if false @test success(ignorestatus(`false`)) - @test success(pipe(ignorestatus(`false`), `true`)) - @test !success(pipe(ignorestatus(`false`), `false`)) + @test success(pipeline(ignorestatus(`false`), `true`)) + @test !success(pipeline(ignorestatus(`false`), `false`)) @test !success(ignorestatus(`false`) & `false`) - @test success(ignorestatus(pipe(`false`, `false`))) + @test success(ignorestatus(pipeline(`false`, `false`))) @test success(ignorestatus(`false` & `false`)) end # STDIN Redirection file = tempname() -run(pipe(`echo hello world`, file)) -@test readall(pipe(file, `cat`)) == "hello world\n" -@test open(readall, pipe(file, `cat`), "r") == "hello world\n" +run(pipeline(`echo hello world`, file)) +@test readall(pipeline(file, `cat`)) == "hello world\n" +@test open(readall, pipeline(file, `cat`), "r") == "hello world\n" rm(file) # Stream Redirection @@ -84,12 +84,12 @@ rm(file) port, server = listenany(2326) put!(r,port) client = accept(server) - @test readall(pipe(client, `cat`)) == "hello world\n" + @test readall(pipeline(client, `cat`)) == "hello world\n" close(server) end @async begin sock = connect(fetch(r)) - run(pipe(`echo hello world`, sock)) + run(pipeline(`echo hello world`, sock)) close(sock) end end @@ -118,7 +118,7 @@ str2 = readall(stdout) # This test hangs if the end of run walk across uv streams calls shutdown on a stream that is shutting down. file = tempname() -open(pipe(`cat -`, file), "w") do io +open(pipeline(`cat -`, file), "w") do io write(io, str) end rm(file) @@ -173,17 +173,17 @@ exename = joinpath(JULIA_HOME, Base.julia_exename()) if valgrind_off # If --trace-children=yes is passed to valgrind, we will get a # valgrind banner here, not "Hello World\n". - @test readall(pipe(`$exename -f -e 'println(STDERR,"Hello World")'`, stderr=`cat`)) == "Hello World\n" + @test readall(pipeline(`$exename -f -e 'println(STDERR,"Hello World")'`, stderr=`cat`)) == "Hello World\n" p = Pipe() - run(pipe(`$exename -f -e 'println(STDERR,"Hello World")'`, stderr = p)) + run(pipeline(`$exename -f -e 'println(STDERR,"Hello World")'`, stderr = p)) @test readall(p) == "Hello World\n" end # issue #6310 -@test readall(pipe(`echo "2+2"`, `$exename -f`)) == "4\n" +@test readall(pipeline(`echo "2+2"`, `$exename -f`)) == "4\n" # issue #5904 -@test run(pipe(ignorestatus(`false`), `true`)) === nothing +@test run(pipeline(ignorestatus(`false`), `true`)) === nothing # issue #6010 diff --git a/test/strings/io.jl b/test/strings/io.jl index 92717a337f8150..63555a9365a42f 100644 --- a/test/strings/io.jl +++ b/test/strings/io.jl @@ -155,7 +155,7 @@ else for encoding in ["UTF-32LE", "UTF-16BE", "UTF-16LE", "UTF-8"] output_path = joinpath(unicodedir, encoding*".unicode") f = Base.FS.open(output_path,Base.JL_O_WRONLY|Base.JL_O_CREAT,Base.S_IRUSR | Base.S_IWUSR | Base.S_IRGRP | Base.S_IROTH) - run(pipe(`iconv -f $primary_encoding -t $encoding $primary_path`, f)) + run(pipeline(`iconv -f $primary_encoding -t $encoding $primary_path`, f)) Base.FS.close(f) end