From: Chris M. <mut...@mc...> - 2003-09-15 22:00:28
|
Hi. I'm sorry. I don't quite understand how this would help. It sounds interesting. Please explain more. Thanks, -Chris Muth On 9/15/03 at 1:26 PM Ed Arnold wrote: >Have you tried an ugly hack? Do something like "mv /dev/tty >/dev/tty.bak" >(very temporarily!), then make /dev/tty a regular file which programs that >require tty, can scribble into. > >Disclaimer: I've only used this hack for input. Your mileage may vary. > > |
From: Chris M. <mut...@mc...> - 2003-09-17 16:13:42
|
Hey, I haven't the faintest idea. Perhaps one of the two brilliant minds the suggested the fix could comment? -Chris Muth On 9/17/03 at 10:03 AM Ed Arnold wrote: >Is this because STDIN is associated with the controlling terminal? > > >> NOT closing STDIN makes the fragment work properly. >> >> Thank You, >> Chris Muth >> >> >> On 9/16/03 at 9:55 PM Austin Schutz wrote: >> >> >On Tue, Sep 16, 2003 at 09:46:51PM -0500, Chris Muth wrote: >> >> Hi, >> >> >> >> I am running; >> >> Perl 5.8 >> >> Expect 1.15 >> >> IO::Tty 1.02 >> >> IO::Stty .02 >> >> Linux 2.2.20 >> >> >> >> I am not sure how cron figures into this, I am not using it for this >> >script. >> >> >> > >> > Haha.. that's what I get for not reading. I'm not sure where I thought >> >you meant cron where you said daemonize. This script will work much >> >better if you don't close stdin/stdout/stderr. They are inherited by= the >> >children when they start. I'm not sure why that is fouling stuff up, >since >> >they get reopened anyway, but it definitely is. >> > Doing setsid() should make it so it doesn't die when the original >> >terminal is closed, but you may want to do setpgrp() so it doesn't die >when >> >the parent (your shell) dies. >> > >> > Austin >> >> >> >> >> >> ------------------------------------------------------- >> This sf.net email is sponsored by:ThinkGeek >> Welcome to geek heaven. >> http://thinkgeek.com/sf >> _______________________________________________ >> Expectperl-discuss mailing list >> Exp...@li... >> https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: Austin S. <te...@of...> - 2003-09-17 18:22:16
|
On Wed, Sep 17, 2003 at 11:12:12AM -0500, Chris Muth wrote: > Hey, > > I haven't the faintest idea. > Perhaps one of the two brilliant minds the suggested the fix could comment? > #close STDIN; close STDOUT; close STDERR; sleep 5; ####################################### # comment out daemonizing code ending here open (LOG_FILE, "> output"); # open log file STDIN, STDOUT, STDERR are handles associates with unix file handles #1, #2, #3. In unix when you open a new file descriptor it uses the first one available. There's a "trick" in Expect where the descriptors are reopened with the new tty in the same order they are closed. By closing them above, weird things begin to happen. First, LOG_FILE takes the STDIN fileno (0). Then the pty gets opened with the next available two filenos, which should be STDOUT and STDERR. Then the child tries to close and reopen filenos 0 and 1 as the terminal, but oops, the parent is expecting to read from the tty on fileno 2, and the child will be writing to 1. Or something like that. Austin |
From: Ed A. <er...@uc...> - 2003-09-15 22:19:10
|
I gathered from your explanation that your expect-perl program wasn't working in daemon mode because it expects to have a controlling tty (i.e. "/dev/tty") to write to. I'm assuming that you're running in daemon mode such that your controlling tty is undefined; i.e. if you did a "ps -ef" (or whatever's appropriate for your system), the "TTY" columns for your daemon process would contain '?'. So maybe (and this is iffy, given the weird things ssh does under the covers) if you move the unusable /dev/tty out of the way and create /dev/tty as an ordinary file your program can write to, things will work. Unfortunately this will require root permission, since /dev/tty is root-owned (at least on Redhat and Solaris). > Hi. > > I'm sorry. I don't quite understand how this would help. > It sounds interesting. Please explain more. > > Thanks, > -Chris Muth > > > On 9/15/03 at 1:26 PM Ed Arnold wrote: > > >Have you tried an ugly hack? Do something like "mv /dev/tty > >/dev/tty.bak" > >(very temporarily!), then make /dev/tty a regular file which programs that > >require tty, can scribble into. > > > >Disclaimer: I've only used this hack for input. Your mileage may vary. > > > > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: Chris S. <cas...@pe...> - 2003-09-16 13:35:20
|
Have you considered that the prompt is just not what you think it is? Have you considered setting the prompt match to something very wide such as /.+/? Just my two cents, Chris |
From: Chris M. <mut...@mc...> - 2003-09-17 02:48:16
|
I don't think that is the problem. The only difference between working and not is whether it is daemonized or= not. -Chris Muth On 9/16/03 at 9:01 AM Chris Snyder wrote: >Have you considered that the prompt is just not what you think it is? >Have you considered setting the prompt match to something very wide such >as /.+/? > >Just my two cents, >Chris |