popen() can't tell if cmd fails

nigel at cmsfl nigel at cmsfl
Sun Jul 1 16:44:21 AEST 1990


As a general question, how much use to people make of the popen()
function in programs where failures must be detected ?

I am working on a program where I would like to use
popen() but can see no way of detecting when the command exits
with a bad status.

At least not easily anyway.

Popen() will return a NULL pointer if the creation of the 
environment to run the command under fail but not if the command
fails.

So I have instead resorted to using system() and two temporary files
which means I am using one temporary file I wouldn't need if popen()
would tell me the exit code.

Your thoughts ?
-- 
<<<<<<<<<<<<<<<<<<<<<<<<<  Nigel Harwood  >>>>>>>>>>>>>>>>>>>>>>>>>>>
<< Post:  Coles Myer Ltd, PO Box 2000 Tooronga 3146, Australia     >>
<< Phone: +61 3 829 6090  E-mail: nigel at cnw01.storesys.coles.oz.au >>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>



More information about the Comp.lang.c mailing list