From: "James M. Lawrence" Date: 2009-01-21T10:25:09+09:00 Subject: [ruby-core:21476] [Bug #907] Various system() and backticks problems on Windows Issue #907 has been updated by James M. Lawrence. Nobu wrote: >> If system("built-in-shell-command", "1") fails on Unix, then it >> should fail on Windows. >> >> If it fails with an alternate shell on Windows, then it should fail >> with all shells. >> >> Why does ruby support system("built-in-shell-command", "1") for >> this one case of Windows + cmd.exe? >> > Many of built-in shell commands of Unix also exist as an independent > file. e.g., /bin/echo, /bin/test, /bin/[ and so on, but not on > Windows. So the reason is Unix emulation on mingw32/mswin32? For those who want it, Unix emulation is already available with Cygwin (which installs echo.exe, date.exe, etc). Those using mingw32/mswin32 do not expect a Unix-like system(). If I understand correctly, the purpose of this "magical" multi-arg form of system() is to handle commands which both (1) exist in cmd.exe and (2) exist as executables on a Unix machine. The only ones I see fitting this description are echo, date, mkdir, rmdir, time, type, md. Notice 'type' and 'md' have different meanings on Windows and Unix. These will silently produce bugs when carried between Unix and Windows machines, thanks to this magical system(). It is not only the Unix namesakes echo, date, etc. which are treated specially, but all cmd.exe commands. The behavior is inconsistent with all other platforms, plus Windows itself with an alternate shell. I believe this "feature" is a mistake, but ultimately it is a minor issue. Since it was the only thing which failed my system() spec, I had to ask. ---------------------------------------- http://redmine.ruby-lang.org/issues/show/907 ---------------------------------------- http://redmine.ruby-lang.org