System() doesn't work but %x does

I’m trying to issue an “svn add” command from a script to add everything
under the current folder to subversion.
Command line works:

svn add --force *

%x / backticks work
out = %x[svn add --force *]

system() does not.
system(‘svn’, ‘add’, ‘–force’, ‘’) produces "svn: warning: '’ not
found"

I suspect there is some subtlety in regard to the expansion of the “*”;
is there any way of making it work with system()?

Thanks.

On 8/21/07, Philip M. [email protected]
wrote:

system(‘svn’, ‘add’, ‘–force’, ‘') produces "svn: warning: '’ not
found"

I suspect there is some subtlety in regard to the expansion of the “*”;
is there any way of making it work with system()?

I guess ‘*’ is handled by the shell. `` invokes the command via shell,
while system does it directly (and you have to expand * yourself).

So, there are two possibilities:

  1. invoke /bin/sh (or whatever shell are you using) with arguments to
    call svn add…
  2. expand it yourself (Dir.glob might be helpful)

NB: I’m curious: why do you insist on system()?

Hi,

At Tue, 21 Aug 2007 07:18:49 +0900,
Jano S. wrote in [ruby-talk:265570]:

found"

I suspect there is some subtlety in regard to the expansion of the “*”;
is there any way of making it work with system()?

I guess ‘*’ is handled by the shell. `` invokes the command via shell,
while system does it directly (and you have to expand * yourself).

To be accurate, system with multiple arguments bypasses shell,
while backticks and system with single string contains shell
metacharacters invokes a shell.

So, there are two possibilities:

  1. invoke /bin/sh (or whatever shell are you using) with arguments to
    call svn add…
  2. expand it yourself (Dir.glob might be helpful)
  1. use single string argument.
    system(‘svn add --force *’)

Jano S. wrote:

NB: I’m curious: why do you insist on system()?

I’m using i386-cygwin and system() seemed to be better behaved when some
of the tools I call are not cygwin based. (such as nant)