Reputation: 4901
Julia's run
function appears to have difficulty running source
. The wierd thing is that it does not have an issue if I run the exact same command in the shell.
Is there a way to run the command programmatically from Julia?
julia> cmd = "/home/me/tensorflow/bin/activate"
"/home/me/tensorflow/bin/activate"
julia> run(`ls $cmd`)
/home/me/tensorflow/bin/activate
julia> run(`source $cmd`)
ERROR: could not spawn `source /home/me/tensorflow/bin/activate`: no such file or directory (ENOENT)
in _jl_spawn at process.jl:262
in anonymous at process.jl:415
in setup_stdio at ./process.jl:403
in __spawn#58__ at ./process.jl:414
in run at ./process.jl:530
shell> source /home/me/tensorflow/bin/activate
Upvotes: 3
Views: 1241
Reputation: 1089
source is built-in command
try like this:
run(`zsh -c "source $cmd"`)
run(`bash -c source $cmd`)
windows:
run(`cmd /c 'echo xxx'`)
Upvotes: 7