Running a child process in Crystal
command = "curl http://dist.crystal-lang.org/apt/setup.sh | bash"
io = IO::Memory.new
status = Process.run(command, shell: true, output: io)
puts status.exit_code
output = io.to_s
Or if you want to duplicate what Crystal does for you:
Process.run("sh", {"-c", command}, output: io)
Written on August 14, 2020, Last update on August 14, 2020
crystal
shell
process