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

Invalid argument? #159

Closed
davidkrider opened this issue Jan 11, 2025 · 5 comments · Fixed by #160
Closed

Invalid argument? #159

davidkrider opened this issue Jan 11, 2025 · 5 comments · Fixed by #160

Comments

@davidkrider
Copy link

This works, and starts a browser which loads Google:

> start "launchy" /b https://google.com

But this doesn't:

> launchy -d https://google.com
LAUNCHY_DEBUG: URI parsing pass 1 : https://google.com -> {:scheme=>"https", :user=>nil, :password=>nil, :host=>"google.com", :port=>nil, :path=>"", :query=>nil, :fragment=>nil}
LAUNCHY_DEBUG: Checking if class Launchy::Application::Browser is the one for handles?(https://google.com)}
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFamily::Windows is the one for matches?(mingw32)}
LAUNCHY_DEBUG: Launchy::Application::Browser : possibility from app_list : start "launchy" /b
LAUNCHY_DEBUG: Launchy::Application::Browser : Using browser value 'start "launchy" /b'
LAUNCHY_DEBUG: ChildProcess: argv => ["start \"launchy\" /b", "https://google.com"]
ERROR: Failure in opening uri "https://google.com" with options {:debug=>true}: Invalid argument - start "launchy" /b
LAUNCHY_DEBUG: ERROR: Failure in opening uri "https://google.com" with options {:debug=>true}: Invalid argument - start "launchy" /b
LAUNCHY_DEBUG: C:/Users/hq785/.gem/ruby/3.2.0/gems/launchy-3.0.1/lib/launchy.rb:43:in `rescue in open'
LAUNCHY_DEBUG: C:/Users/hq785/.gem/ruby/3.2.0/gems/launchy-3.0.1/lib/launchy.rb:39:in `open'
LAUNCHY_DEBUG: C:/Users/hq785/.gem/ruby/3.2.0/gems/launchy-3.0.1/lib/launchy/cli.rb:66:in `good_run'
LAUNCHY_DEBUG: C:/Users/hq785/.gem/ruby/3.2.0/gems/launchy-3.0.1/lib/launchy/cli.rb:81:in `run'
LAUNCHY_DEBUG: C:/Users/hq785/.gem/ruby/3.2.0/gems/launchy-3.0.1/exe/launchy:5:in `<top (required)>'
LAUNCHY_DEBUG: C:/Users/hq785/.gem/ruby/3.2.0/bin/launchy:36:in `load'
LAUNCHY_DEBUG: C:/Users/hq785/.gem/ruby/3.2.0/bin/launchy:36:in `<main>'
Try `launchy --help' for more information.

I've looked all through the code, but I can't figure out what "Invalid argument" is referring to. As you can see, I'm sitting in the directory of the latest version of the gem. I've cleaned up other references (in the AppData directory). This is the one I'm calling:

> which launchy
/c/Users/hq785/.gem/ruby/3.2.0/bin/launchy

I can't figure out what I'm doing wrong.

@davidkrider
Copy link
Author

I see now that this is failing in the "childprocess" gem. Kernel::Process.spawn() doesn't like the way the command is passed:

["start \"launchy\" /b", "https://google.com"]

But this works:

["start", "\"launchy\"", "/b", "https://google.com"]

So I changed:

def windows_app_list
  ['start', '"launchy"', '/b']
end

@copiousfreetime
Copy link
Owner

This probably has something to do with the shell processor in previous version of windows. Since I do not have a windows machine to test this on - -- I'll just take your word for it and update.

@copiousfreetime
Copy link
Owner

I'll push out a new version of the gem in the morning and if you could test it that would be great.

@copiousfreetime
Copy link
Owner

@davidkrider Version 3.1.0 is pushed to rubygems -- give it a go

@copiousfreetime
Copy link
Owner

Closing this as I have not heard back.

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

Successfully merging a pull request may close this issue.

2 participants