- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Coprocess exit code reading
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2004 03:21 AM
тАО12-16-2004 03:21 AM
Coprocess exit code reading
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2004 09:11 AM
тАО12-16-2004 09:11 AM
Re: Coprocess exit code reading
define a repear trap at the begninning:
export COPID COPIDERR
trap 'wait $COPID; COPIDERR=$?' CHLD
immediately after spawning the coproc, capture its PID:
coproc |&
COPID=$!
when the coprocess terminates, COPIDERR will be set to its exit status, so you can look at it whenever you want.
- Tags:
- trap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2004 02:10 AM
тАО12-17-2004 02:10 AM
Re: Coprocess exit code reading
"Traps are not processed while a job is waiting for a foreground process. Thus, a trap on CHLD won't be executed until the foreground job terminates."
What does this mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2004 04:54 AM
тАО12-17-2004 04:54 AM
Re: Coprocess exit code reading
Can you attach your script or show us the relevant segments?
Make sure that you are using single quotes:
trap 'wait $COPID; COPIDERR=$?' CHLD
trap commands are evaluated twice: once when defined and once when taken. This means that
trap "wait $COPID; COPIDERR=$?" CHLD
may set the trap to 'wait; COPIDERR=' which is meaningless.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2004 05:38 AM
тАО12-17-2004 05:38 AM
Re: Coprocess exit code reading
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2004 11:19 AM
тАО12-17-2004 11:19 AM
Re: Coprocess exit code reading
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2004 02:06 AM
тАО12-20-2004 02:06 AM