Re: [Hampshire] Is my program detached?

Top Page

Reply to this message
Author: Adrian Bridgett
Date:  
To: Stephen Pelc, Hampshire LUG Discussion List
Subject: Re: [Hampshire] Is my program detached?
On Tue, Sep 29, 2009 at 13:28:02 +0100 (+0100), Stephen Pelc wrote:
> Under Kubuntu 9.04 at least, trying to open /dev/tty succeeds in
> both cases and fds 0,1,2 return true from isatty(). Similarly,
> ttyname() returns a name.


Hmm, that was going to be my suggestion. Perhaps you could see whether
FD0 was readable since normallly backgrounded apps block when they
need STDIN.

I still think isatty is wise check - e.g. if someone runs it from cron
or somesuch.

Adrian
--
bitcube.co.uk - Linux infrastructure consultancy
Puppet, Debian, Red Hat, Ubuntu, CentOS, ...