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

Suppress new proccess output #51

Closed
fuadsaud opened this issue Sep 11, 2012 · 12 comments
Closed

Suppress new proccess output #51

fuadsaud opened this issue Sep 11, 2012 · 12 comments
Labels
Milestone

Comments

@fuadsaud
Copy link

Didn't find a way to suppress or redirect the STDOUT of new proccess.

@copiousfreetime
Copy link
Owner

Can you show me an example of what you mean?

@fuadsaud
Copy link
Author

Sure! Take this example:

Launchy.open 'http://github.com'

Google Chrome / Chromium are going to print "Created new window in existing browser session." to STDOUT. I wish I could be able to redirect the output of the process to somewhere else, (like /dev/null).

@copiousfreetime
Copy link
Owner

Hrm, it looks like this may be platform dependent. I do not see this on OSX.

jeremy@stiletto:~ ruby-1.9.3-p194 % cat x.rb
require 'launchy'
puts "Launchy version #{Launchy::VERSION}"
Launchy.open 'http://github.com'

jeremy@stiletto:~ ruby-1.9.3-p194 % ruby -rubygems ./x.rb 
Launchy version 2.1.2
jeremy@stiletto:~ ruby-1.9.3-p194 % 

jeremy@stiletto:~ ruby-1.9.3-p194 % rvm use 1.8.7
Using /Users/jeremy/.rvm/gems/ruby-1.8.7-p358
jeremy@stiletto:~ ruby-1.8.7-p358 % ruby -rubygems ./x.rb 
Launchy version 2.1.2
jeremy@stiletto:~ ruby-1.8.7-p358 %

What is the platform you are on and your launchy version?

@fuadsaud
Copy link
Author

Ubuntu 12.04 LTS 64bit 3.2.0-29

Launchy 2.1.2

@copiousfreetime
Copy link
Owner

Thanks, I was able to replicate it now. It appears to possibly be an Ubuntu only issue, or maybe a linux only issue. I think I'll attempt to figure out why it is happening first, and then once i understand that, I'll put in an output redirection or an appropriate flag to the launch command to deal with it.

Thanks for finding this bug!

@sferik
Copy link

sferik commented Feb 2, 2013

Has there been any progress on this issue in the past 5 months? It is causing issues for users of one of my gems: sferik/t-ruby#77. If no one else is actively working on this, I can look into it, but it will be harder for me to reproduce, since I don't run Ubuntu. I guess I can spin up a Vagrant box.

@fuadsaud
Copy link
Author

fuadsaud commented Feb 4, 2013

hum, I don't think Ubuntu is needed in this case. Is just a simple STDOUT redirection. Not sure about Windows support however.

@sferik
Copy link

sferik commented Feb 5, 2013

@copiousfreetime, thanks for fixing this! Very much looking forward to the next release.

@copiousfreetime
Copy link
Owner

New release pushed v2.2.0

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Feb 15, 2013
= Launchy Changlog
== Version 2.2.0 - 2013-02-06

* Change XFCE detection to not depend on grep (copiousfreetime/launchy#52 -
  thanks bogdan)
* Suppress forked process output (copiousfreetime/launchy#51)
* Display help/usage if no url is given (copiousfreetime/launchy#54)
* Detect the fluxbox environment (copiousfreetime/launchy#53)
* Automatically detect 'http' url's if they are missing the 'http://'
  (copiousfreetime/launchy#55)
* Update to latest project management rake tasks
jperkin pushed a commit to TritonDataCenter/pkgsrc-legacy that referenced this issue Dec 9, 2013
= Launchy Changlog
== Version 2.2.0 - 2013-02-06

* Change XFCE detection to not depend on grep (copiousfreetime/launchy#52 -
  thanks bogdan)
* Suppress forked process output (copiousfreetime/launchy#51)
* Display help/usage if no url is given (copiousfreetime/launchy#54)
* Detect the fluxbox environment (copiousfreetime/launchy#53)
* Automatically detect 'http' url's if they are missing the 'http://'
  (copiousfreetime/launchy#55)
* Update to latest project management rake tasks
jperkin pushed a commit to TritonDataCenter/pkgsrc-legacy that referenced this issue Mar 14, 2014
= Launchy Changlog
== Version 2.2.0 - 2013-02-06

* Change XFCE detection to not depend on grep (copiousfreetime/launchy#52 -
  thanks bogdan)
* Suppress forked process output (copiousfreetime/launchy#51)
* Display help/usage if no url is given (copiousfreetime/launchy#54)
* Detect the fluxbox environment (copiousfreetime/launchy#53)
* Automatically detect 'http' url's if they are missing the 'http://'
  (copiousfreetime/launchy#55)
* Update to latest project management rake tasks
jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Oct 11, 2014
= Launchy Changlog
== Version 2.2.0 - 2013-02-06

* Change XFCE detection to not depend on grep (copiousfreetime/launchy#52 -
  thanks bogdan)
* Suppress forked process output (copiousfreetime/launchy#51)
* Display help/usage if no url is given (copiousfreetime/launchy#54)
* Detect the fluxbox environment (copiousfreetime/launchy#53)
* Automatically detect 'http' url's if they are missing the 'http://'
  (copiousfreetime/launchy#55)
* Update to latest project management rake tasks
@david-s-svedberg
Copy link

Still experiencing the issue in version 2.4.3 running on Ubuntu 14.04. As before, when executing Launchy.open(url) it opens the url in chrome but I get an output to stdout "Created new window in existing browser session."

@nunosilva800
Copy link

Same here, it's kinda annoying...

@copiousfreetime
Copy link
Owner

@david-s-svedberg @Onumis At the moment, launchy should be capturing all its stdout/stderr in the child process that launches chrome, and only displaying it if there was an exception. The relevant code is https://github.com/copiousfreetime/launchy/blob/master/lib/launchy/detect/runner.rb#L133-L141.

Feel free to put some debugging into there and see if the same thing occurs. The easy burn test would be to explicitly add $stdout.close and $stderr.close instead of saving them off to the side in StringIO and see if that alleviates your issue.

If, when doing this, you no longer see Created new window in existing browser session. then there is something going on with the file descriptors that I'm unfamiliar with.

If you still see the output from chrome, then I'm not sure where that output is coming from or how it is getting to your console.

In any case, if someone has a Vagrant file handy that I can use to setup a system in the same manner you have, that would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants