Skip to content

Commit

Permalink
make sure Cmd constructor is nestable (fixes bug introduced by JuliaL…
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj committed Nov 24, 2015
1 parent 003f415 commit 8235bc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/process.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ immutable Cmd <: AbstractCmd
new(cmd.exec, ignorestatus, flags, env,
dir === cmd.dir ? dir : cstr(dir))
function Cmd(cmd::Cmd; ignorestatus::Bool=cmd.ignorestatus, env=cmd.env, dir::AbstractString=cmd.dir,
detach::Bool=Bool(cmd.flags & UV_PROCESS_DETACHED),
windows_verbatim::Bool=Bool(cmd.flags & UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS),
windows_hide::Bool=Bool(cmd.flags & UV_PROCESS_WINDOWS_HIDE))
detach::Bool = 0 != cmd.flags & UV_PROCESS_DETACHED,
windows_verbatim::Bool = 0 != cmd.flags & UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS,
windows_hide::Bool = 0 != cmd.flags & UV_PROCESS_WINDOWS_HIDE)
flags = detach*UV_PROCESS_DETACHED |
windows_verbatim*UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS |
windows_hide*UV_PROCESS_WINDOWS_HIDE
Expand Down
3 changes: 3 additions & 0 deletions test/spawn.jl
Original file line number Diff line number Diff line change
Expand Up @@ -337,3 +337,6 @@ end

# make sure windows_verbatim strips quotes
@windows_only readall(`cmd.exe /c dir /b spawn.jl`) == readall(Cmd(`cmd.exe /c dir /b "\"spawn.jl\""`, windows_verbatim=true))

# make sure Cmd is nestable
@test string(Cmd(Cmd(`ls`, detach=true))) == "`ls`"

0 comments on commit 8235bc1

Please sign in to comment.