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

IO.popen(*command) fails #15

Closed
bobthecow opened this issue Aug 10, 2012 · 6 comments
Closed

IO.popen(*command) fails #15

bobthecow opened this issue Aug 10, 2012 · 6 comments

Comments

@bobthecow
Copy link

in Ruby 1.9.3 (here: https://github.com/alloy/terminal-notifier/blob/master/Ruby/lib/terminal-notifier.rb#L20 )

Removing the star works:

      IO.popen(command) do |stdout|
        output = stdout.read
        STDOUT.print output if verbose
        result << output
      end

whee!

@alloy
Copy link
Collaborator

alloy commented Aug 10, 2012

Awww damn, I thought I had tested that. Thanks!

@alloy
Copy link
Collaborator

alloy commented Aug 10, 2012

Hmm, it seems to work for me on 1.9.3-p194. Which version are you on?

@bobthecow
Copy link
Author

1.9.3p194.

It works with a string, or with a single-element array. But it fails with multi-element arrays:

IO.popen("echo sup dawg")          # works
IO.popen(["echo", "sup", "dawg"])  # works
IO.popen(*["echo sup dawg"])       # works
IO.popen(*["echo", "sup", "dawg"]) # fails
ArgumentError: wrong number of arguments (3 for 1..2)

This is consistent with the documentation, which says it takes either a string or an array of strings as the first argument.

@alloy alloy closed this as completed in d348df5 Aug 10, 2012
@alloy
Copy link
Collaborator

alloy commented Aug 10, 2012

You’re completely right. Thanks!

@alloy
Copy link
Collaborator

alloy commented Aug 10, 2012

Released as 1.4.2

@bobthecow
Copy link
Author

Awesome :)

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

No branches or pull requests

2 participants