This is actually working as expected.   The return code of the command you 
are running is returned in the process's "Return Code" field.  Note that 
the "grep"  command returns 0 if it finds one or more '&' in the output 
file.  But, grep returns 1 if it does not find '&' in the output file. The 
process's "Return Code" contains the value that the grep command returns.

You can view grep's return code after running a grep command (without 
STAF) via a terminal using"echo $?".  For example:

If the output from a command like "ls /usr/local/staf" contains one or 
more "S"s in it, grep's return code is 0.

# ls /usr/local/staf | grep 'S' -c
7
# echo $?
0

Note that grep's stdout data contains 7 (the number of times it found an 
'S').

However, if the output from a command like "ls /usr/local/staf" does not 
contain one or more "&"s in it, grep's return code is 1.

# ls /usr/local/staf | grep '&' -c
0
# echo $?
1

Note that grep's stdout output contains 0 (the number of times it found 
'0').

So, similarly, when this grep command is run via a STAF PROCESS START 
request and grep does not find a '&' in the output from "ls 
/usr/local/staf", the

C:\>staf staf1e process start shell command "ls /usr/local/staf | grep '&' 
-c" wait returnstdout stderrtostdout
Response
--------
{
  Return Code: 1       <== The return code from the command
  Key        : <None>
  Files      : [
    {
      Return Code: 0
      Data       : 0   <== The content of stdout/stderr

    }
  ]
}

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:   "Gopalakrishna, Monika" <monika.gopalakris...@ca.com>
To:     Sharon Lucas/Austin/IBM@IBMUS, 
Cc:     "staf-users@lists.sourceforge.net" 
<staf-users@lists.sourceforge.net>
Date:   12/18/2011 12:00 PM
Subject:        RE: [staf-users] STAF Response code 1



Hi ,
            I have a problem in STAF.
when I run a command on linux machine using staf from windows and expect 
‘0’ as the output of a command, I am getting Data:0 but response code is 
1.
[The command without staf is running fine on linux machine]
Command is : 
Staf linuxmachinename process start shell command "(cd 
/crawls/gnipjob/gerbil_old/jobs/brighthand/output/ && exec zcat *.gz | 
grep ‘&’ -c)"
[This command is just trying to find ’ &’  in the output file]
                        If the expected output is more than 0 , then 
response code is 0.
If Expected output is 0 [if ‘&’ does not exist in the log file]
I am getting return as:
 
Response
--------
{
  Return Code: 1
  Key        : <None>
  Files      : [
    {
      Return Code: 0
      Data       : 0
 
    }
  ]
}
Help appreciated
 
Regards,
Monika
 
Sr. Quality Assurance Engineer
Scripting Test Automation is my Art Form......
 


<<image/gif>>

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to