[prev in list] [next in list] [prev in thread] [next in thread] 

List:       groovy-dev
Subject:    Re: [groovy-dev] Re: Execute a command that has another command as
From:       Merlyn Albery-Speyer <curious.attempt.bunny () gmail ! com>
Date:       2011-02-23 16:04:58
Message-ID: 1298477098.3383.2.camel () dozer
[Download RAW message or body]

You could try the most verbose form of execute:

http://groovy.codehaus.org/groovy-jdk/java/lang/String%5B%
5D.html#execute%28java.lang.String[],%20java.io.File%29

Something along the lines of

String[] env = ...
File workingDirectory = ...
String[] cmd = ['p4d', '-r', '/dbpath/', '-c', 'command2']

cmd.execute(env, workingDirectory)

On Wed, 2011-02-23 at 02:41 -0800, aatwi wrote:
> Hi Merlyn, 
> 
> Thanks a lot for your reply. 
> 
> I have not tried it in java, but I was using it with an ant script and it
> was working perfectly. 
> The command I am trying to execute is the following perforce command "p4d -r
> /dbpath/ -c 'command2' "
> I have added a line to print out the output and error, and apparently the
> p4d is not understanding the  'command2' part of the command when executed
> from groovy. 
> The error output was: "Unexpected arguments."
> 
> Adding Process.wait doesn't work either. Could it be because different
> interpretation of the ' character in the command between unix and groovy? 
> 
> Thanks, 
> Ahmad



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic