The Crystal Programming Language Forum

Process::ORIGINAL_STDOUT and ORIGINAL_STDERR change

Hello,

I am upgrading my code from Crystal 0.30.1 to 0.35.1. When I compile with the newer version, I get the following error.
Error: undefined constant Process::ORIGINAL_STDOUT

These constants were defined in 0.30.1 and are not present in 0.35.1. I searched through the releases notes and through API, but could not find what I should replace these with. Can someone please point me in the right direction?

Thank you.

Sorry for the question. I found the answer here:

def run_cmd(cmd, args)
  stdout = IO::Memory.new
  stderr = IO::Memory.new
  status = Process.run(cmd, args: args, output: stdout, error: stderr)
  if status.success?
    {status.exit_code, stdout.to_s}
  else
    {status.exit_code, stderr.to_s}
  end
end
1 Like