The STAX User's Guide is correct. A <process> element starts a process
and waits for the process to complete (which is why there's no <wait>
element, because it always waits for the process to complete). The STAX
service generates a PROCESS START request under the covers. This request
doesn't use the WAIT option (so as not to tie up a thread), but uses the
NOTIFY ONEND option so that a STAF/Process/End notification message is
sent to the STAX service handle's queue when the process completes. The
STAX service checks its queue for all STAF/Process/End notification
messages so that it knows when a process ends. So, even though it doesn't
use the WAIT option, the <process> element does not complete until the
command it submitted completes.
However, I don't think your issue has anything to do with this if you are
running the process on the local machine (e.g. the STAX service machine)
as your example showed.
I think the problem is because you're not using the same command value in
your STAX job that you did when submitting it from the command line. If
you used the same command, it should work. In your STAX job example you
specified command:
"C:\Program Files\my company\my product name\command_util.exe" -w -c
But in your STAF command line example you specified command:
"C:\Program Files\my company\my product name\command_util.exe"
-wait:120 -command get roamer.RoamingMode
Note that I put the command and parms value all within the command value
as I think it's simpler that way.
Also, in your STAX job, you may need to escape the backslash character
(with a backslash) so that Python doesn't think \t is a tab character
within your directory path.
I think you should log the command that you're running to make sure that
it is running the command you think it should be running (as shown in my
sample).
Try the following in your STAX job:
<script>
workdir = 'C:\\Program Files\\my company\\my product name'
cmd = '"%s\\command_util.exe" -wait:120 -command get
roamer.RoamingMode' % (workdir)
</script>
<log message="1">
'Starting a process using command %s' % (cmd)
</log>
<process>
<location>'local'</location>
<command mode="'shell'" >cmd</command>
<workdir>workdir</workdir>
<stderr mode="'stdout'"/>
<returnstdout/>
</process>
<if expr="RC != 0">
<log message="1">
'Process failed with RC=%s STAFResult=%s STAXResult=%s' % (RC,
STAFResult, STAXResult)
</log>
</if>
--------------------------------------------------------------
Sharon Lucas
IBM Austin, [EMAIL PROTECTED]
(512) 838-8347 or Tieline 678-8347
Tom Daggett <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
04/02/2008 03:19 PM
To
staf-users@lists.sourceforge.net
cc
Subject
[staf-users] problem running command-line exe from <process> element in
STAX
Hi,
I'm trying to run a command-line utility exe using the <process> element
in STAX. When I try to run the command-line utility from inside a STAX
job, the job just hangs and never finishes.
This is how I'm trying to run the utility in the STAX job:
<process>
<location>'local'</location>
<command mode="'shell'" >'"C:\Program Files\my company\my product
name\command_util.exe"'</command>
<parms>' -w -c '</parms>
<workdir>'C:\Program Files\my company\my product name'</workdir>
<stderr mode="'stdout'"/>
<returnstdout/>
</process>
To troubleshoot, I tried running this from a command prompt with the
STAF command and found that this command runs successfully:
C:\> staf local process start shell command "\"C:\program files\my
company\my product name\command_util.exe\"" parms " -wait:120 -command
get roamer.RoamingMode" wait stderrtostdout returnstdout
The crucial item seems to be the 'wait' option just before
'stderrtostdout'. If I remove this 'wait' option the command doesn't
run successfully.
So my question is, how do I include the 'wait' logic in the STAX job?
In reading the STAX Users Guide, it says that the specific 'wait' option
is not allowed in a STAX <process> element.
Does anyone know what the 'wait' option does? or how to run something in
STAX without it?
Thanks for any suggestions,
Tom Daggett
--
Tom Daggett | QA Automation Specialist, Engineering
t +1 514.747.5222 x295
e [EMAIL PROTECTED]
Trellia | Securing Mobility
www.trellia.com
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users