LoginSignup
1
1

More than 3 years have passed since last update.

Juliaのshellモードや外部プロセス(Windows)

Last updated at Posted at 2020-11-27

Running External Programs
https://docs.julialang.org/en/v1/manual/running-external-programs/
にて、つまずいたので。

julia> mycommand = `echo hello`
`echo hello`

julia> typeof(mycommand)
Cmd

julia> run(mycommand);
hello

マニュアルでは上のようになっているが
run(mycommand);でうまくいかない。

julia> run(mycommand);
ERROR: IOError: could not spawn `echo hello`: no such file or directory (ENOENT)
Stacktrace:
 [1] _spawn_primitive(::String, ::Cmd, ::Array{Any,1}) at .\process.jl:99
 [2] #585 at .\process.jl:112 [inlined]
 [3] setup_stdios(::Base.var"#585#586"{Cmd}, ::Array{Any,1}) at .\process.jl:196
 [4] _spawn at .\process.jl:111 [inlined]
 [5] run(::Cmd; wait::Bool) at .\process.jl:439
 [6] run(::Cmd) at .\process.jl:438
 [7] top-level scope at REPL[29]:1

となってしまう。

https://github.com/JuliaLang/julia/issues/23597
によるとシェルモードを扱うのにgit bashを組み込んでいるのが問題みたい???

cmd /c echo helloでうまくいきます。

julia> mycommand = `cmd /c echo hello`
`echo hello`

julia> run(mycommand);
hello
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1