External program with string argument interpolation

What happens if you do:

julia> cmd=`gdb -batch -ex "disassemble/rs dexp" /tmp/libdexp_C.so`

julia> run(cmd)

Because, as you can see:

julia> dump(cmd)
Cmd
  exec: Array{String}((5,))
    1: String "gdb"
    2: String "-batch"
    3: String "-ex"
    4: String "disassemble/rs dexp"
    5: String "/tmp/libdexp_C.so"
  ignorestatus: Bool false
  flags: UInt32 0x00000000
  env: Nothing nothing
  dir: String ""

ARGV[4] is the complete string not splitted by the space. So I expect it to work as you want to have it.

Noteworthy: run doesn’t run the command in a shell :Running External Programs · The Julia Language

The command is never run with a shell. Instead, Julia parses the command syntax directly, appropriately interpolating variables and splitting on words as the shell would, respecting shell quoting syntax. The command is run as julia 's immediate child process, using fork and exec calls.

2 Likes