Skip to content

Instantly share code, notes, and snippets.

@indirect
Created June 14, 2013 18:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indirect/5784251 to your computer and use it in GitHub Desktop.
Save indirect/5784251 to your computer and use it in GitHub Desktop.
ruby child process with non-buffered output
# give the child process a terminal so output isn't buffered
@master, slave = PTY.open
in_clean_environment do
@pid = ::Process.spawn(
config.env,
%Q(bash -c "#{config.command}"),
:in => slave,
:out => slave,
:err => slave,
:chdir => config.dir,
:pgroup => true
)
end
@indirect
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment