Skip to content

Commit

Permalink
Suppress output from Forkable Runners.
Browse files Browse the repository at this point in the history
This should hopefully fix #51
  • Loading branch information
copiousfreetime committed Feb 5, 2013
1 parent 5ed063c commit b0c7319
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion HISTORY.rdoc
Expand Up @@ -2,7 +2,7 @@
== Version 2.2.0 - 2013-XX-XX

* Chagne XFCE detection to not depend on grep (copiousfreetime/launchy#52 - thanks bogdan)

* Suppress forked process output (copiousfreetime/launchy#51)

== Version 2.1.2 - 2012-08-06

Expand Down
10 changes: 10 additions & 0 deletions lib/launchy/detect/runner.rb
Expand Up @@ -102,11 +102,21 @@ def wet_run( cmd, *args )
class Forkable < Runner
def wet_run( cmd, *args )
child_pid = fork do
close_file_descriptors unless Launchy.debug?
Launchy.log("wet_run: before exec in child process")
exec( *shell_commands( cmd, *args ))
exit!
end
Process.detach( child_pid )
end

def close_file_descriptors
[$stdin, $stdout, $stderr].each do |io|
io.reopen( "/dev/null", "r+" )
end
end

private :close_file_descriptors
end
end
end

0 comments on commit b0c7319

Please sign in to comment.