Free Downloads, Community Forum,
FAQs and Developer Resources


Make /Tools Your Home | Link to us

Today's posts | Posts since last visit | Most Active Topics

All Forums Register Login Search Subscriptions My Profile Inbox
Tool Warehouse FAQs Resources Help Member List Address Book Logout

Script runnign Win32 programs and STDOUT

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [SFU / Interix / SUA Technology] >> Interix Advanced Forum >> Script runnign Win32 programs and STDOUT Page: [1]
Login
Message << Older Topic   Newer Topic >>
Script runnign Win32 programs and STDOUT - Jul. 28, '06, 1:17:17 PM   
rdfdlf

 

Posts: 5
Joined: Jul. 28, '06,
Status: offline
I have written and tested a script that uses both UNIX and Windows commands. When I execute the script from a shell it works correctly. When I execute the script from inside another Unix program the script works but I lose all of the STDOUT messages after any WIN32 program runs for the rest of the script. Thoughts?
Post #: 1
RE: Script runnign Win32 programs and STDOUT - Jul. 28, '06, 1:32:22 PM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
Have a look at the cat32 man page for some explanation.
And try adding cat32 into the script to help.

(in reply to rdfdlf)
Post #: 2
RE: Script runnign Win32 programs and STDOUT - Jul. 28, '06, 2:18:38 PM   
rdfdlf

 

Posts: 5
Joined: Jul. 28, '06,
Status: offline
Already tried that. No effect.

(in reply to Rodney)
Post #: 3
RE: Script runnign Win32 programs and STDOUT - Jul. 28, '06, 3:01:19 PM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
Perhaps some more details would us or an example.
What sort of Win32 commands cause this?
Are they invoked straight or through an helper script?
Is the Win32 command on a line by itself, part of a statement, a subshell, ...?
How is the Unix program started that invokes the script?
How do you know the script completed and just didn't exit/die at the Win32 command?

(in reply to rdfdlf)
Post #: 4
RE: Script runnign Win32 programs and STDOUT - Jul. 28, '06, 11:27:45 PM   
markfunk

 

Posts: 670
Joined: Mar. 31, '03,
Status: offline
quote:

When I execute the script from inside another Unix program the script works but I lose all of the STDOUT messages after any WIN32 program runs for the rest of the script. Thoughts?
Probably. But we need a small shell script sample that displays this behaviour.

(in reply to Rodney)
Post #: 5
RE: Script runnign Win32 programs and STDOUT - Jul. 29, '06, 5:02:49 PM   
rdfdlf

 

Posts: 5
Joined: Jul. 28, '06,
Status: offline
Here are the details.
1. Any WIN32 program or command. I have tried several.
2. They are invoked directly in theis script.
3. WIN32 program/command on seperate line.
4. The original main UNIX program is started from a wrapper script. It uses an EXEC line but I have also tried removing the EXEC from that with no help.
5. The script works perfectly. The only difference from running the script outside the main program or called form inside the main program is that I lose STDOUT coming from it. I cannot see any messages from the remainder of the commands.
6. The main UNIX program is designed to listen for STDIN, STDOUT, and STDERR. It will start a new process to run the called script and then return when finished.
I am think that there is something different about the WIN32 program running in the script that is causing the main from to no longer capture any of the STD information.

(in reply to markfunk)
Post #: 6
RE: Script runnign Win32 programs and STDOUT - Jul. 30, '06, 1:05:05 AM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
> 4. The original main UNIX program is started from a wrapper script. ...

Yes, but what is this run from? A shell or cron or ?
This is important to know.

> ...I cannot see any messages from the remainder of the commands.

How do you know the script is still running? Output can stop coming if the script dies.

(in reply to rdfdlf)
Post #: 7
RE: Script runnign Win32 programs and STDOUT - Jul. 31, '06, 8:56:22 AM   
rdfdlf

 

Posts: 5
Joined: Jul. 28, '06,
Status: offline
The main UNIX program is started from a Windows service using the following command line: "C:\WINNT\system32\psxrun.exe". This then opens a Korm shell and runs the wrapper script.

(in reply to Rodney)
Post #: 8
RE: Script runnign Win32 programs and STDOUT - Jul. 31, '06, 2:12:20 PM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
Well that's the reason.
Win32 has it programs depending on the existence of a console.
The Win32 service does not generate a console in its Windowstation.
Win32 processes can only handle certain types of stdin/stdout/stderr file handles.
When you run from a shell you have a Win32 console available as a side-effect of the
display being Win32 managed. For each Win32 program you call you need to check that
both its stdin and stdout are attached to something like "/dev/null":
foobar.exe < /dev/null > /dev/null
or an appropriate location that won't cause the Win32 program to die:
foobar.exe < /dev/null | cat32

(in reply to rdfdlf)
Post #: 9
RE: Script runnign Win32 programs and STDOUT - Aug. 1, '06, 9:08:38 AM   
rdfdlf

 

Posts: 5
Joined: Jul. 28, '06,
Status: offline
Thanks for the information. I will investigate.

(in reply to Rodney)
Post #: 10
Page:   [1]
All Forums >> [SFU / Interix / SUA Technology] >> Interix Advanced Forum >> Script runnign Win32 programs and STDOUT Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Search All Forums -

Advanced search


SPONSORS



Forum Software © ASPPlayground.NET Advanced Edition 2.5 ANSI

0.094