Project

General

Profile

Actions

Bug #12634

closed

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

Bug #12634: Ruby converts '*' on command line to a file name

Added by krwq (Krzysztof Wicher) about 9 years ago. Updated about 9 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) about 9 years ago Actions #1 [ruby-core:76602]

output is random file name (tags got removed)

Updated by avit (Andrew Vit) about 9 years ago Actions #2 [ruby-core:76604]

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) about 9 years ago Actions #3 [ruby-core:76605]

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) about 9 years ago Actions #4 [ruby-core:76617]

  • Status changed from Open to Closed

Updated by usa (Usaku NAKAMURA) about 9 years ago Actions #5 [ruby-core:76724]

  • Status changed from Closed to Rejected

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

Actions

Also available in: PDF Atom