I got it working by specifying the SAMECONSOLE option in the staf
command line.

 

 

ie, STAF local PROCESS START COMMAND "C:/script/createtables.bat"
WORKDIR "C:/script" WAIT RETURNSTDOUT STDERRTOSTDOUT SAMECONSOLE

 

 

The following in User Guide helped me:-

 

"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."

 

Many thanks, 
Saneesh Joseph. 

________________________________

From: Sharon Lucas [mailto:luc...@us.ibm.com] 
Sent: Wednesday, May 13, 2009 8:15 PM
To: Joseph, Saneesh
Cc: staf-users@lists.sourceforge.net
Subject: Re: [staf-users] Batch script terminates halfway under STAF.

 


A PROCESS START request provides a STDIN option to specify a standard
input file to a command.  Try the following: 

1) STAF local PROCESS START COMMAND "C:/script/createtables.bat" WORKDIR
"C:/script" WAIT RETURNSTDOUT STDERRTOSTDOUT STDIN "password.txt" 

Does that work?  If not what is the output? If it doesn't work try: 

2) Create a empty file, e.g. C:/script/empty.txt, and do: 

  STAF local PROCESS START COMMAND "C:/script/createtables.bat" WORKDIR
"C:/script" WAIT RETURNSTDOUT STDERRTOSTDOUT STDIN "empty.txt" 

If that doesn't work, try removing the < password.txt  from your bat
file and then try the PROCESS START request in 1). 

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




<saneesh.jos...@rsa.com> 

05/13/2009 08:14 AM 

To

<staf-users@lists.sourceforge.net> 

cc

David Bender/Austin/i...@ibmus 

Subject

Re: [staf-users] Batch script terminates halfway under STAF.

 

 

 




I found out the issue is because of the input redirection from
password.txt. The less than symbol ( < ) causes the issue. But didn't
get a solution yet... :-( 
  

Many thanks, 
Saneesh Joseph. 

 

________________________________


From: Joseph, Saneesh 
Sent: Wednesday, May 13, 2009 6:30 PM
To: 'staf-users@lists.sourceforge.net'
Cc: 'bda...@us.ibm.com'
Subject: Batch script terminates halfway under STAF. 
  
Folks, 
  
I have a windows batch file which is running properly when I run it. But
when I run it using STAF, it doesn't complete its execution 
  
  
Createtable.bat 
======= 
@echo off 
echo create table mytable(id integer)>myscript.sql 
echo CREATING TABLES 
psql -h localhost -p 5432 -U postgres -d postgres -f myscript.sql <
password.txt 
echo DONE! 
========= 
  
When I run it manually (using command prompt), it shows 
  
C:\script>createtables.bat 
CREATING TABLES 
Password: 
CREATE TABLE 
DONE! 
  
When I run it using STAF, 
  
C:\script>staf local process start command "c:\script\createtables.bat"
WORKDIR "c:\script" wait returnstdout stderrtostdout 
Response 
-------- 
{ 
  Return Code: 255 
  Key        : <None> 
  Files      : [ 
    { 
      Return Code: 0 
      Data       : CREATING TABLES 
Password: 
CREATE TABLE 
More? 
    } 
  ] 
} 

Precisely, it executes psql command and then exits. After that it shows
"More?" in the response!!!. I have no idea what is happening... :-(
Please help me out.. 

Many thanks, 
Saneesh Joseph. 
 
------------------------------------------------------------------------
------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks
to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK
i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled.
http://p.sf.net/sfu/kodak-com___________________________________________
____
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to