"SystemError: edit: No error" when EDITOR unset in Windows

A rather minor thing in the overall scheme of things, but @edit on Windows gives this rather strange error message when I try the macro without setting an EDITOR or JULIA_EDITOR variable.

julia> @edit sin(42)
ERROR: SystemError: edit: No error
Stacktrace:
 [1] #systemerror#44 at .\error.jl:64 [inlined]
 [2] systemerror(::Symbol, ::Bool) at .\error.jl:64
 [3] edit(::String, ::Int32) at .\interactiveutil.jl:66
 [4] edit(::Function, ::Any) at .\interactiveutil.jl:88

This happens both in Windows Powershell and cmd, and also in Cygwin. It makes sense that not setting the EDITOR variables would throw an error (though that doesn’t seem the intent of the code), but this error message doesn’t direct users towards any useful steps, and is just confusing.

I’m on Julia 0.6, and a look at the code of interactiveutil.jl tells me the editor gets set to open if the EDITOR variables are not specified, and the code tries a ccall on open followed by the path to the file.

        @static is_windows() && # don't emit this ccall on other platforms
            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)

That call is presumably what leads to the “No error” error. The code is practically the same in the new InteractiveUtils module, so the behaviour is probably the same in the latest versions.

Do others running Julia on Windows see this issue when EDITOR variables are unset? Is this worth opening a github issue over?

julia> versioninfo()
Julia Version 0.6.0
Commit 903644385b* (2017-06-19 13:05 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM)2 Duo CPU     P8600  @ 2.40GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Penryn)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, penryn)

julia> Base.editor()
1-element Array{String,1}:
 "open"

julia> ENV["EDITOR"]
ERROR: KeyError: key "EDITOR" not found
Stacktrace:
 [1] access_env(::Base.##288#289, ::String) at .\env.jl:14
 [2] getindex(::Base.EnvHash, ::String) at .\env.jl:78

julia> ENV["JULIA_EDITOR"]
ERROR: KeyError: key "JULIA_EDITOR" not found
Stacktrace:
 [1] access_env(::Base.##288#289, ::String) at .\env.jl:14
 [2] getindex(::Base.EnvHash, ::String) at .\env.jl:78