From: Eric Hodel Date: 2006-11-29T16:58:22+09:00 Subject: Re: I'm a process-spawning idiot. On Nov 28, 2006, at 2350 , Paul Lutus wrote: > Devin Mullins wrote: > >> I'm looking for a method that, like Kernel#` and IO::popen, allows >> me to >> call out to the system and grab its stdout. However, I'd like it to >> accept multiple args (like Kernel#system), so I don't have to worry >> about filenames with spaces and backslashes and the like. >> Alternatively, >> I'll take a lib that escapes strings for Kernel#`, provided it >> works on >> win32, unix, cygwin... >> >> I'm sure I'm just missing the obvious. Help? > > You want to what? You want to execute an arbitrary system command and > collect the command's output? > > data = `command arg1 arg2 arg3` > > Obviously if the provided command line works in a shell, it will > work here, > and vice versa. system 'command', 'arg with spaces' will execute correctly (ARGV[0] will be 'arg with spaces') `command arg with spaces` requires manual intervention (ARGV[0] will be 'arg'). That said, try playing with shell.rb. I don't really know what it does, though. -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net I LIT YOUR GEM ON FIRE!