Skip to content

Commit

Permalink
use ShellExecuteW rather than cmd for edit function on Windows (#20571)
Browse files Browse the repository at this point in the history
use ShellExecuteW rather than cmd for edit function on Windows (closes #20364)
  • Loading branch information
stevengj authored Feb 14, 2017
1 parent cfbad5f commit 2ecc215
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions base/interactiveutil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ function edit(path::AbstractString, line::Integer=0)
cmd = line != 0 ? `$command $path:$line` : `$command $path`
elseif startswith(name, "notepad++")
cmd = line != 0 ? `$command $path -n$line` : `$command $path`
elseif is_windows() && (name == "start" || name == "open")
cmd = `cmd /c start /b $path`
line_unsupported = true
elseif is_apple() && (name == "start" || name == "open")
elseif is_apple() && name == "open"
cmd = `open -t $path`
line_unsupported = true
else
Expand All @@ -63,7 +60,11 @@ function edit(path::AbstractString, line::Integer=0)
line_unsupported = true
end

if background
if is_windows() && name == "open"
systemerror(:edit, ccall((:ShellExecuteW,"shell32"), stdcall, Int,
(Ptr{Void}, Cwstring, Cwstring, Ptr{Void}, Ptr{Void}, Cint),
C_NULL, "open", path, C_NULL, C_NULL, 10) 32)
elseif background
spawn(pipeline(cmd, stderr=STDERR))
else
run(cmd)
Expand Down

0 comments on commit 2ecc215

Please sign in to comment.