Skip to content

Instantly share code, notes, and snippets.

@pta2002

pta2002/main.cr Secret

Created May 29, 2017 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pta2002/91c5c8404d6d5f442d81bc041ba12024 to your computer and use it in GitHub Desktop.
Save pta2002/91c5c8404d6d5f442d81bc041ba12024 to your computer and use it in GitHub Desktop.
IO.pipe do |read, write|
child = Process.fork
if child.nil?
Process.exec("cat", ["/etc/hostname"], input: false, output: write, error: write)
else
while !child.terminated?
puts "The program wrote #{read.gets}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment