From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2002-01-06T10:14:57+09:00 Subject: [ruby-talk:30318] Re: Need help understanding system() call In article <002401c195a0$78391f40$0301a8c0@inf>, John Wheeler wrote: >This is a multi-part message in MIME format. > >------=_NextPart_000_0021_01C1956E.2A72EAC0 >Content-Type: text/plain; > charset="iso-8859-1" >Content-Transfer-Encoding: quoted-printable > >I have a quick question for anyone willing to help out a newbie:=20 > >Does the Windows ruby installation package "ruby165-0.exe" from=20 >rubycentral.com expect the user to be also running the cygwin >environment to be able to do a system() call? > >I just installed the ruby165-0.exe package on a machine that has >Windows98 and the DJGPP environment installed. I have found that some >scripts that use the system() call do not seem to function correctly. I experienced this same problem today: I was helping someone setup Ruby and my task distribution system (Distributor) today on their Windows PC which does not have cygwin installed. Some of the code specific to their application uses system calls. While it worked fine on my Laptop (with cygwin installed) it did not work in their environment without cygwin. I worked around it by definging a 'win_system' routine that uses the 'system' in the Win32API: def win_system(command) Win32API.new("crtdll","system",['P'],'L').Call(command) end win_system("") I then replaced the system calls with win_system calls, it worked fine. ....and it was a lot quicker than downloading cygwin ;-) You could probably even do something where you check to see what platform you're running on and then define 'system' to call 'win_system' if you're on Windows, or you could even redefine 'system' in Kernal this way. Phil