On Friday, May 17, 2002, at 08:02 , Postman Pat wrote:

> What I meant is test to see if we were run from an interactive shell, if
> so, print an error message.


assume

        code_A calls Code_B

if code_A has not 'daemonized' and detached from
the controlling terminal - then the (-t STDIN) will
show up as being valid when tested in Code_B...

a quick rehack of yesterdays daemon

        http://www.wetware.com/drieux/pbl/Sys/daemon1.txt

gets us
[jeeves:/tmp] drieux% sed 's/^/    /' *2.stdout
     We are 16623 - fired up at Fri May 17 08:27:47 2002
     We Slurped Up :We Have NO Controlling Terminal
      :
     shutting down at Fri May 17 08:27:47 2002
[jeeves:/tmp] drieux%
        
{ it calls Code_B }

whereas:
[jeeves:/tmp] drieux% Code_A
We Have A Controlling Terminal
[jeeves:/tmp] drieux%

does that help a bit???

ciao
drieux

---

the diff of the daemons is:
[jeeves:drieux/pbl/Sys] drieux% diff dae* ~/perl/daemons/daemon2
36a37,39
 >
 > print "We Have A Controlling Terminal\n" if (-t);
 >
43,44c46,50
< dumbDoWork(100,6);
<
---
 > #dumbDoWork(100,6);
 > open(CODEB, "/Users/drieux/bin/Code_B |") or die "No Good Code_B:$!\n";
 > my @slurp = <CODEB>;
 > close CODEB;
 > print "We Slurped Up :@slurp :\n";
[jeeves:drieux/pbl/Sys] drieux%

jeeves%  for file in Cod*
for> do
for> echo $file
for> sed 's/^/### /' $file
for> echo "#--------------"
for> done
Code_A
### #!/usr/bin/perl
###
### system(CODE_B);
#--------------
Code_B
### #!/usr/bin/perl
###
### if (-t) {
###     print "We Have A Controlling Terminal\n";
### }else {
###     print "We Have NO Controlling Terminal\n";
### }
#--------------
jeeves%


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to