Created
June 14, 2013 18:46
-
-
Save indirect/5784251 to your computer and use it in GitHub Desktop.
ruby child process with non-buffered output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
stolen from https://github.com/zerowidth/ringleader/blob/master/lib/ringleader/process.rb#L117-L129