Does command interpolation work on Windows?


#1

I have a code that does something like:

run(̣`$julia_path $script_path`)

It works perfect on linux (where I’m developing), but I’m getting the following error on AppVeyor (Windows):

ERROR: LoadError: syntax: invalid escape sequence
 in include_from_node1 at .\loading.jl:488
 in process_options at .\client.jl:265
 in _start at .\client.jl:321
while loading C:\Users\appveyor\AppData\Local\Temp\1\jl_D347.tmp.jl, in expression starting on line 2
Information: Error During Test
  Got an exception of type LoadError outside of a @test
  LoadError: failed process: Process(`'C:\projects\julia\bin\julia' 'C:\Users\appveyor\AppData\Local\Temp\1\jl_D347.tmp.jl'`, ProcessExited(1)) [1]

I tried by changing the command a couple of times, but it looks like there is a problem in command interpolation of the julia_path variable on Windows (Julia 0.5). Is It possible?

AppVeyor log: https://ci.appveyor.com/project/diegozea/mitos-jl/build/1.0.430/job/5bdeor8okt8kgy37

Best regards,


#2

julia_path is not defined on my computer

try this instead:

script_path="c:\\temp\\puth.jl"
run(`$JULIA_HOME\julia.exe $script_path`)

This works for me on Win 10


#3

Thank @bernhard! You post help me to find the problem. I was using

juliapath = joinpath(JULIA_HOME,Base.julia_exename())

to define the julia path. But in windows, julia_exename() doesn’t add the ".exe" extension. So, the code fails because of the missing ".exe". So I add the following lines to solve the problem:

if is_windows() & !endswith(juliapath,".exe")
    juliapath = juliapath * ".exe"
end