Actions
Bug #12634
closedRuby converts '*' on command line to a file name
Bug #12634:
Ruby converts '*' on command line to a file name
Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.1p112 (2016-04-26 revision 54768) [x64-mingw32]
Description
Repro:
- ruby script.rb *
- script.rb:
puts ARGV[0]
output:
expected output:
*
OS: Windows 10
This is annoying when passing glob as an arg. Also happens when passing anything starting with *
Updated by krwq (Krzysztof Wicher) almost 10 years ago
output is random file name (tags got removed)
Updated by avit (Andrew Vit) almost 10 years ago
This is handled by your shell before passing to ruby. Compare:
ruby -e 'puts ARGV.inspect' *
["file1", "file2"]
ruby -e 'puts ARGV.inspect' '*'
["*"]
Updated by shyouhei (Shyouhei Urabe) almost 10 years ago
Andrew, I guess this is the key part:
OS: Windows 10
So yes, ruby handles glob in pace of Unix shells on this platform. As far as I remember this is by design.
Updated by nobu (Nobuyoshi Nakada) almost 10 years ago
- Status changed from Open to Closed
Updated by usa (Usaku NAKAMURA) almost 10 years ago
- Status changed from Closed to Rejected
Anyway, although on Windows, use '*' to prevent globbing.
Actions