commander-rb / commander

The complete solution for Ruby command-line executables
MIT License
821 stars 74 forks source link

The `find` statement fails on Windows #4

Open ggilder opened 9 years ago

ggilder commented 9 years ago

From @kodybrown on March 11, 2014 17:0

The following statement fails; user_interaction.rb line #240:

find {|name| system("hash #{name.split.first} 2>&-") }

I changed it to this, which now works:

find {|name| system("hash #{name.split.first} 2>&1") }

But, now I don't know where to find hash.. Is this a bash util or built-in lib somewhere? I tried gem install hash but it does not seem to be what it is looking for..

I'm running bro (on Windows) which uses commander..

Copied from original issue: tj/commander#69

ggilder commented 9 years ago

hash is a shell builtin that shows you the cached hash table of available commands.

It looks like a change to &1 would be ok here since we're not using the output of hash. Normally &- is used to close a file descriptor, see http://www.tldp.org/LDP/abs/html/io-redirection.html

Does that change solve the issue for you, or is there still some issue with hash?

If it solves it feel free to put together a pull request. Thanks!