From d3e9d212c6811b94253693a804e6dd6bdb9ccf8c Mon Sep 17 00:00:00 2001 From: Katharine Hyatt Date: Wed, 11 Jul 2018 14:06:26 -0400 Subject: [PATCH] Doc the at-cmd macro --- base/process.jl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/base/process.jl b/base/process.jl index 68228df104c0b..e097118dde2ce 100644 --- a/base/process.jl +++ b/base/process.jl @@ -824,6 +824,22 @@ function cmd_gen(parsed) return Cmd(args) end +""" + @cmd str + +Similar to `cmd`, generate a `Cmd` from the `str` string which represents the shell command(s) to be executed. +The [`Cmd`](@ref) object can be run as a process and can outlive the spawning julia process (see `Cmd` for more). + +# Examples +```jldoctest +julia> cm = @cmd " echo 1 " +`echo 1` + +julia> run(cm) +1 +Process(`echo 1`, ProcessExited(0)) +``` +""" macro cmd(str) return :(cmd_gen($(esc(shell_parse(str, special=shell_special)[1])))) end