The Crystal Programming Language Forum

Writing to the stdin of an external program?

Which would be the equivalent of this Ruby code?

open("| pbcopy", "w") do |io|
  io.write(str)
end

I think it’s:

Process.run("pbcopy") do |process|
  process.input.print "hello world!"
end
2 Likes

Neat! Thanks Ary.