Skip to content

Instantly share code, notes, and snippets.

@chef
Created May 27, 2009 15:50
Show Gist options
  • Save chef/118704 to your computer and use it in GitHub Desktop.
Save chef/118704 to your computer and use it in GitHub Desktop.
pw, pr, pe, ps = IO.pipe, IO.pipe, IO.pipe, IO.pipe
verbose = $VERBOSE
begin
$VERBOSE = nil
ps.last.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
cid = fork {
pw.last.close
STDIN.reopen pw.first
pw.first.close
pr.first.close
STDOUT.reopen pr.last
pr.last.close
pe.first.close
STDERR.reopen pe.last
pe.last.close
STDOUT.sync = STDERR.sync = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment