I had a typo in my last example showing how to specify same console for the <process> element. It should have been:
<process name="'Run Test'"> <location>machine</location> <command mode="'shell'">command</command> <workdir>'C:\\AutomatedTesting\\TestScripts\\libs'</workdir> <stderr mode="'stdout'"/> <returnstdout/> <console use="'same'"/> </process> Note that in my previous example I accidently had the <console> element between the <stderr> and <returnstdout> elements. -------------------------------------------------------------- Sharon Lucas IBM Austin, luc...@us.ibm.com (512) 286-7313 or Tieline 363-7313 ----- Forwarded by Sharon Lucas/Austin/IBM on 11/08/2010 01:16 PM ----- From: Sharon Lucas/Austin/i...@ibmus To: Eileen Wei <e...@fekete.com> Cc: "staf-users@lists.sourceforge.net" <staf-users@lists.sourceforge.net> Date: 11/08/2010 01:11 PM Subject: Re: [staf-users] How to find out what's the actual process command being executed from STAX? You could use the <log> element to log the command that you are trying to run via a <process> to see if your command is what you had intended.. The message will be logged in the STAX Job User Log and displayed in the Message panel if you are monitoring the STAX job using the STAX Monitor. For example: <script> command = 'pybot.bat -v VMX_PATH:%s -v APP:%s -v VERSION:%s -v BRANCH:%s -d %s silkTest.html' % \ (vm_vmxPath_map[product_vm_map[product]], product, version, branch, os.path.join(result_root, product, version)) </script> <log message="1"> 'Starting a process to run command %s on machine %s...' % (command, machine) </log> <process name="'Run Test'"> <location>machine</location> <command mode="'shell'">command</command> <workdir>'C:\\AutomatedTesting\\TestScripts\\libs'</workdir> <stderr mode="'stdout'"/> <returnstdout/> </process> Note that instead of using <parms>, I specified the entire command including its parameters in the <command> value. I googled for errror " “WindowsError: [Error 6] The handle is invalid”" and one of the hits was 'subprocess "handle is invalid" error' at http://www.megasolutions.net/python/subprocess--handle-is-invalid--error-50439.aspx . This indicates a problem that can occur if all three input/output streams are not redirected when using the Python subprocess module. Does your python script use subprocess? I'm not familiar with what pybot.bat does. If it uses stdin, then you may be running into a problem discussed in section "8.12 Process Service" in the STAF User's Guide at http://staf.sourceforge.net/current/STAFUG.htm#HDRPROCSTR. This section contains a note that says: "Notes 1. On Windows systems, if you are redirecting stdin/out/err and are not using SAMECONSOLE, it is recommended that you redirect all three input/output streams. If one or two streams are redirected, but not all three, the non-redirected streams will not be available to the application. For example, if stdout and stderr are redirected, but not stdin, then the application will receive errors if it tries to read from standard input. As another example, if stdin and stdout are redirected, but not stderr, then you will not see any of the standard error output displayed in the console window. This problem only occurs when using NEWCONSOLE, which is the default. You may freely redirect any combination of stdin, stdout, and stderr when using SAMECONSOLE. This problem is due to a known limitation in the Windows API." So, you could try changing your <process> element to either redirect stdin or to share the same console as STAFProc. You are redirecting stdout and stderr but not stdin. To do redirect stdin to an empty file, first create an empty file on the machine where the process will be run and add a <stdin> element containing the name of the empty file you created. For example, if you created an empty file named C:\temp\emptyFile on the test machine, then your <process> element could be changed to look like the following: <process name="'Run Test'"> <location>machine</location> <command mode="'shell'">command</command> <workdir>'C:\\AutomatedTesting\\TestScripts\\libs'</workdir> <stdin>'C:\\temp\\emptyFile'</stdin> <stderr mode="'stdout'"/> <returnstdout/> </process> Or, instead of creating an empty file and specifying it for <stdin>, you could specify for the process to use the same console as STAFProc. For example; <process name="'Run Test'"> <location>machine</location> <command mode="'shell'">command</command> <workdir>'C:\\AutomatedTesting\\TestScripts\\libs'</workdir> <stderr mode="'stdout'"/> <console use="'same'"/> <returnstdout/> </process> -------------------------------------------------------------- Sharon Lucas IBM Austin, luc...@us.ibm.com (512) 286-7313 or Tieline 363-7313 From: Eileen Wei <e...@fekete.com> To: "staf-users@lists.sourceforge.net" <staf-users@lists.sourceforge.net> Date: 11/08/2010 12:25 PM Subject: [staf-users] How to find out what's the actual process command being executed from STAX? Hi, I am running stax in my Win7 machine. I have a stax job which contains the following lines: <process name="'Run Test'"> <location>machine</location> <command mode="'shell'">'pybot.bat'</command> <parms> '-v VMX_PATH:%s -v APP:%s -v VERSION:%s -v BRANCH:%s -d %s silkTest.html' % (vm_vmxPath_map[product_vm_map[product]], product, version, branch, os.path.join(result_root, product, version)) </parms> <workdir>'C:\\AutomatedTesting\\TestScripts\\libs'</workdir> <stderr mode="'stdout'"/> <returnstdout/> </process> I have clicked “Test” button to make sure “Validation successful” before submitting the job. And I have manually run the same command (pybot ...) from a command window and make sure it works. However, when running from stax, a one point I got “WindowsError: [Error 6] The handle is invalid” , and I am wondering what might have gone wrong? Also, I am thinking after the %s string substitution, maybe the actually command that’s executed is not what I have expected, but I don’t know how to find out what’s the actual command that’s executed from stax? Thanks, Eileen ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ staf-users mailing list staf-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/staf-users ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ staf-users mailing list staf-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/staf-users ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ staf-users mailing list staf-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/staf-users