Bug #4396
closedwindows commands starting with "@" should run at all even though command string is quoted by `"'.
Description
Updated by kosaki (Motohiro KOSAKI) almost 14 years ago
=begin
If you are writing C and you need to run "@echo" command, you should escape the string by `^' (caret).
ie,¶
main()
{
system("^@echo foo");
}
It's MSVCRT spec. I'm not sure ruby's system() method should follow it or not.
Maybe we need a discussion.
=end
Updated by jonforums (Jon Forums) almost 14 years ago
=begin
fwiw, behavior on win7 32-bit with lua v5.1.4 and python v2.7.1...
C:>lua -e "os.execute('@echo foo')"
foo
C:>lua -e "os.execute('^@echo foo')"
'@echo' is not recognized as an internal or external command,
operable program or batch file.
C:>python -c "import os;os.system('@echo foo')"
foo
C:>python -c "import os;os.system('^@echo foo')"
'@echo' is not recognized as an internal or external command,
operable program or batch file.
=end
Updated by jonforums (Jon Forums) almost 14 years ago
=begin
and...
C:>lua -e "os.execute("^@echo foo")"
foo
C:>python -c "import os;os.system("^@echo foo")"
foo
=end
Updated by kosaki (Motohiro KOSAKI) almost 14 years ago
=begin
Hi Jon,
Thanks for good demonstration. It encourage to me very much.
But #3 is a bit misleading. ^ was removed when command line parsing (ie python interpreter invoking) phase. therefore system() haven't seen ^.
Example, Please see following one liner.
c:\ruby\trunk\build>python -c "print "^@echo foo""
@echo foo
=end
Updated by kosaki (Motohiro KOSAKI) over 13 years ago
- Status changed from Open to Rejected
=begin
I tried to change this behavir by r30987. but it made a regression.
example, r30987 broke test_process.rb#test_popen_shell(). because
IO.popen(%[#{bat.dump} "foo 'bar'"]) pass a follwoing string to cmd.exe.
"path with space/bat test.bat" "foo 'bar'"
But cmd.exe can't parse it. IOW, current ruby's system() has slightly different parser against cmd.exe and some tests depend on it.
So, sadly, we can't break backward compatibility. Let's reject this ticket.
=end