In an irb
console these lines execute as I expect:
require 'open3'
stdout, stderr, exit_status = Open3.capture3('clang-format < tmp')
puts stdout
puts stderr
puts exit_status
That is, the output of command clang-format < tmp
is printed out through stdout
; for stderr
the value is nil
and for exit_status
the output is pid 28181 exit 0
.
However, when I execute them in a script the output for stdout
is empty, but the value of exit_status
is printed out.
Why that? Could someone please illuminate me?