I have an application that when started in the background (&),
stops executing and gives me this error after I hit a carriage
return.
JSBach 69# !../
../cni.tcl &
[1] 1073
JSBach 70#
[1] + Stopped (tty input) ../cni.tcl
JSBach 70#
JSBach 70# fg
Then it continues just fine!
I tried flushing the "fileid" given from the open call, then I closed the
fileid, the stdin, and stdout but I can not get it right.
Any ideas!, I'm using Tcl7.4b3 & Tk4.0b3
Thanks.
--
Roger Savard
sav...@centrcn.umontreal.ca Services Informatiques
Gestion des environnements Universite de Montreal
ps : i tried to reply by email but it failed...
dl
--
<A HREF="http://hplyot.obspm.fr/~dl/">Laurent Demailly</A>
--
+---------------------------------------------------------+
| Roger Savard |
| ro...@centrcn.umontreal.ca Services Informatiques |
| Gestion des environnements Universite de Montreal |
+---------------------------------------------------------+
: I have an application that when started in the background (&),
: stops executing and gives me this error after I hit a carriage
: return.
The return is neccessary because it triggers your shell
to deliver the message about the background process.
No understanding, but with tk4.0b3 I found a similar problem
some minutes ago:
Only if my prog is started in the background: "b2.tcl &"
When I start a fileevent I get get the following message:
Stopped (tty input) b2.tcl&
*************************
*Solution: start it with*
*b2.tcl </dev/null & *
*************************
Why in the world does "wish" want to read from stdin ???
In my case it could be related to "fileevent" ???
Joerg
===========================================================================
_
Jorg Petersen, 1. Physikalisches Institut
pete...@pi1.physik.uni-stuttgart.de Universitaet Stuttgart
Tel.: 0711/685-4954 Pfaffenwaldring 57
Fax.: 0711/685-4886 D-70550 Stuttgart, Germany
for the input problem, maybe the tcl_interactive is not set correctly
(prompting stdin) or some function somewhere in the code does a bad [gets
stdin] ...
sorry for the misleading first answer,
Regards
> : I have an application that when started in the background (&),
> : stops executing and gives me this error after I hit a carriage
> : return.
>
> No understanding, but with tk4.0b3 I found a similar problem
> some minutes ago:
> Only if my prog is started in the background: "b2.tcl &"
> When I start a fileevent I get get the following message:
> Stopped (tty input) b2.tcl&
>
> Why in the world does "wish" want to read from stdin ???
> In my case it could be related to "fileevent" ???
I "fixed" this problem a while back, but I had to add a new function to
Tcl to do it.
The problem is that, in tclMain.c (and, presumably, this is analogous to
what happens in wish, though I haven't checked), in the read_from_input/
do_command loop, tclsh uses this statement to read from the input:
if (fgets(buffer, 1000, stdin) == NULL) {
The problem with this is, is blocks. Therefore, if you are running in the
background, and you hit this statement and stdin is the tty, you will get
the message you discribed. I imagine that tcl's "gets" command has the
same proble, though I haven't checked..
This was bad for me, because I had an event driven tcl application (a MUD
client/server) that I wanted to be able to backround and forground at
will. Also, when it was in the forground, I wanted it to act as a tcl
interpreter (while it was still processing interupts, too). So, your
solution wouldn't have worked for me.
What I did was write a c function that acted as a non-blocking
mini-interpreter. I create an event loop, and simply call the function
periodically. It does everything the normal tclsh interpeter does, and
looks exactly the same, but it never blocks, so when you background the
process, it keeps doing whatever it's doing, but doesn't process anything
more from the tty until you forground it again. If you slightly modify my
code, you could easily get a non-blocking version of "gets", too.
If anyone wants a copy of this code, let me know, and I'll E-Mail it to
you. It's written in g++, but it should be fairly portable.
--
Brian
: I have an application that when started in the background (&),
: stops executing and gives me this error after I hit a carriage
: return.
Your application , possible usess gets stdin , or something like that ,
which requires access to tty and can't be run in the background ...
To avoid this problem either don't use gets stdin or use tcl extension
called expect ( its available from ftp.aud.alcatel.com /tcl/extensions )
--
Dima
di...@tochna.technion.ac.il
I then replaced all occurances of (open "| ..." r) by (open "|..." r+)
flush $some_id ; close $some_id and it works fine!
Thanks.
--
+---------------------------------------------------------+
| Roger Savard |
| sav...@centrcn.umontreal.ca Services Informatiques |