Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using stderr instead of sockets #291

Open
kostya opened this issue Dec 29, 2020 · 0 comments
Open

Using stderr instead of sockets #291

kostya opened this issue Dec 29, 2020 · 0 comments

Comments

@kostya
Copy link
Owner

kostya commented Dec 29, 2020

can simplify code by much:

how xtime can do it:

r, w = IO.pipe
pid = Process.spawn(*["ruby", "-e", "5.times do; STDERR.puts('msg'); sleep 1; end"], {err: w})

Thread.new do
  while true
    if IO.select([r])
      p r.read_nonblock(1024)
    end
  end
end

Process.wait(pid)
w.close
r.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant