Project

General

Profile

Bug #8550

On Windows Process.spawn 'command', 'arg1', 'arg2', ... evals the arguments

Added by mdesantis (Maurizio De Santis) about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.0.0p195 (2013-05-14) [x64-mingw32]
[ruby-core:55572]

Description

=begin
Environment: ruby 2.0.0p195 (2013-05-14) x64-mingw32 on Windows 7 64bit

According to the Process.spawn documentation, the syntax 'cmdname, arg1, ...' doesn't involve the shell. Indeed, on Unix this is true: ((%Process.spawn 'echo', '$PATH'%)) prints '$PATH'.

But on Windows the behaviour is different: executing ((%Process.spawn 'echo', '%Path%'%)) prints the contents of the Path environment variable.

I think the behaviour should be the same on the different OSes; at least, if it is not possible, the documentation should point it out.
=end

Associated revisions

Revision 42391
Added by zzak (Zachary Scott) about 4 years ago

  • process.c: [DOC] Document caveats of command form of Process.spawn with regard to the shell and OS. Patched by Steve Klabnik [Bug #8550]

Revision 42391
Added by zzak (Zachary Scott) about 4 years ago

  • process.c: [DOC] Document caveats of command form of Process.spawn with regard to the shell and OS. Patched by Steve Klabnik [Bug #8550]

Revision 42391
Added by zzak (Zachary Scott) about 4 years ago

  • process.c: [DOC] Document caveats of command form of Process.spawn with regard to the shell and OS. Patched by Steve Klabnik [Bug #8550]

Revision 42391
Added by zzak (Zachary Scott) about 4 years ago

  • process.c: [DOC] Document caveats of command form of Process.spawn with regard to the shell and OS. Patched by Steve Klabnik [Bug #8550]

History

#1 [ruby-core:55573] Updated by luislavena (Luis Lavena) about 4 years ago

Hello,

On Windows, 'echo' is not an external command, is part of cmd.exe internal commands, like cd and others.

#2 [ruby-core:55586] Updated by nobu (Nobuyoshi Nakada) about 4 years ago

  • Category set to doc

This is a spec.
Otherwise you have to write system(ENV["COMSPEC"], "/c", "echo foo"), and it seems too messy.

Patches for the rdoc are welcome.

#4 Updated by zzak (Zachary Scott) about 4 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r42391.
Maurizio, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • process.c: [DOC] Document caveats of command form of Process.spawn with regard to the shell and OS. Patched by Steve Klabnik [Bug #8550]

Also available in: Atom PDF