From: Shusaku Date: 2001-07-06T02:08:51+09:00 Subject: [ruby-talk:17333] Re: ` (back tick) on Win32 machines On Thu, 5 Jul 2001 23:24:34 +0900 Stephan K�mper wrote: > Hmmm. I'm still a bit (a byte to be true) puzzled. That's because it works > as (I) expected with Perl, eg > > print `dir` > > works fine in the Perl flavour I use on both Win2K and Win98. And I wished > it'd be the same behaviour in Ruby. That would make migrating form Win98 to > Win2K (or vice versa) a lot more easy (No need to detect the Win flavour and > then chose cmd.exe or command.com respectively.) What do you get from an environment variable 'COMSPEC'? I get this on Win2K. C:\WORK>echo %COMSPEC% C:\WINNT\system32\cmd.exe And I get 'COMSPEC=C:\WINDOWS\COMMAND.COM' on Win98. I'm using "ruby 1.6.4 (2001-06-04) [i586-mswin32]", compiled with VC6. ruby -e 'puts `dir`' # works fine. perl -e "print `dir`" # works fine too. (ActiveState's Perl) Then I saw different behavior with improper COMSPEC, when perl works still fine. C:\WORK>set COMSPEC=C:\Wombat.exe C:\WORK>ruby -e 'puts `dir`' -e:1:in ``': No such file or directory - "dir" (Errno::ENOENT) from -e:1 And surprised result ... (but, Perl still worked!) C:\WORK>set COMSPEC= <-- remove the variable C:\WORK>ruby -e 'puts `dir`' -e:1: [BUG] Segmentation fault ruby 1.6.4 (2001-06-04) [i586-mswin32] abnormal program termination -- Shusaku