cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

ACL sh command - getting values returned by the command executed

william_maclean
4-Participant

ACL sh command - getting values returned by the command executed

Hello,

I am new to ACL.

 

We are trying to use the sh command to call Tortoise SVN, and are hoping there is a way to get the value returned by the command that sh calls. For example, we were hoping something like this might work:

 

    local testVariable = sh svn commit C:\filepath\filename

    if(testVariable==0) { response('success'); }

    if(testVariable==1) { response('failure'); }

 

Where svn returns 0 or 1 for success or failure. We tried the above, and it doesn't work.

 

Does anyone know if there is anyway to use sh and get the value returned by the command it executes?

 

Thanks,

Will

 

5 REPLIES 5

I'm not sure "sh" can capture the output, but you could always call a .bat file that updates a shared .txt file, then have Arbortext open that .txt file after "sh" returns so you can read the results out of the file.

Thanks, @GarethOakes. I appreciate the help. We'll give bat files a shot.

I've also done something similar very recently with Perl, if you can call Perl from Arbortext then you can use the backticks syntax ($var = `mycommand.exe -param`;) to capture the output. To capture STDERR as well as STDOUT you just append 2>&1 to the command line($var = `mycommand.exe -param 2>&1`;).

Hi Gareth,

First - thanks very much for your responses.

 

We did try using a batch file and sending the output to a file, but for some reason, it wouldn't send the svn output to the file - just kept echoing it on the command line.

 

We will probably try a solution more like what you are doing with Perl, but in Java.

 

Have a good one,

Will

This is basically the approach I've taken in the past. Redirect your command output to a text file (using the 2>&1 modifier to route both stderr and stdout to the same file, if necessary), and then read the text file into Arbortext after the command is done to get its output.

Top Tags