System command wonâ€™t work with arguments. For example, a simple test in Windows (launch Notepad from ruby..) command = 'c:\windows\notepadâ€™ arg = â€œmyfile.txtâ€ system(command, arg) Remove the arg and Notepad launches fine. Notepad (or any other program) won't launch with command line arguments. Am I missing something? Larry.
on 2010-09-30 23:12
on 2010-10-01 00:07
On 9/30/2010 4:13 PM, Larry Jones wrote: > > Am I missing something? I can't explain what the problem is, but if you add .exe to the command string, it will work. My guess is that the system command is not properly processing the given arguments to ultimately pass on to the Win32 CreateProcess call. BTW, this appears to be fixed in Ruby 1.9.1. -Jeremy
on 2010-10-01 00:28
On Sep 30, 6:13 pm, Larry Jones <misterljo...@yahoo.com> wrote: > System command won’t work with arguments. > Please always indicate which version of Ruby are you talking about (run "ruby -v") > calling system() with multiple arguments is not candidate of command/ shell expansion, it assumes you know what are you doing. C:\windows\notepad does not exist... is notepad.exe You need to include all. This has changed in Ruby 1.9 but Ruby 1.8 is "broken" or not smart enough to deal with this. Which brings again the importance of always tell us which version are you talking about.
on 2010-10-01 17:56
Luis Lavena wrote: > Thanks for your response... the ".exe" makes no difference. Appears to be a bug. Larry.
on 2010-10-01 18:17
On 10/01/2010 10:56 AM, Larry Jones wrote: > Luis Lavena wrote: >> > Thanks for your response... > > the ".exe" makes no difference. What version of Ruby are you using? Send us the results of running ruby -v. I was running Ruby 1.8.7-p299 in order to find that workaround. > Appears to be a bug. It's definitely a bug, and one that is fixed in the 1.9 series. Are you seeing this under Ruby 1.9? -Jeremy
on 2010-10-02 10:23
Hi Larry, You need to let us know what version of Ruby you're using. Type ruby -v at the command line and paste the results back here. Charles
on 2010-10-02 22:38
Charles Roper wrote: > Hi Larry, > > You need to let us know what version of Ruby you're using. Type ruby > -v at the command line and paste the results back here. > > Charles Thanks Charles, I'm running version 1.8.6 Thanks for catching the bug. Larry.