Project

General

Profile

Actions

Bug #12634

closed

Ruby converts '*' on command line to a file name

Added by krwq (Krzysztof Wicher) over 7 years ago. Updated over 7 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.1p112 (2016-04-26 revision 54768) [x64-mingw32]
[ruby-core:76601]

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) over 7 years ago

output is random file name (tags got removed)

Updated by avit (Andrew Vit) over 7 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) over 7 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) over 7 years ago

  • Status changed from Open to Closed

Updated by usa (Usaku NAKAMURA) over 7 years ago

  • Status changed from Closed to Rejected

Anyway, although on Windows, use '*' to prevent globbing.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0