From: Paul Brannan Date: 2001-11-14T00:31:26+09:00 Subject: [ruby-talk:25017] Re: changing the shell used by 'system' On Tue, 13 Nov 2001, Joel VanderWerf wrote: > > Is it possible to determine what shell Ruby is going to use for spawned > commands? Ruby tries to do the best it can to determine whether it is possible to do a simple fork+exec of the process, and if it can, then it will. That is, if you do: system("rm -f foo") then Ruby will call fork() and it will then exec() /bin/rm. However, if you do: system("ls > foo") then Ruby will call fork() and it will then exec() sh -c "ls > foo", because of the special character '>'. This, of course, appears to be completely system-dependant, so I don't recommend depending on its behavior if you can avoid it. A much better solution would be to use Kernel#fork and Kernel#exec yourself, or to use IO#popen. Paul