Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

+ Stopped (tty input)

1,525 views
Skip to first unread message

Roger Savard

unread,
May 4, 1995, 3:00:00 AM5/4/95
to
Hi,

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


Laurent Demailly

unread,
May 5, 1995, 3:00:00 AM5/5/95
to

It has prolly nothing to do with tcl, try "stty -tostop" at unix
prompt before lunching the prog in the background
(you might have noticed that "ls &" would have the same 'problem')

ps : i tried to reply by email but it failed...

dl
--
<A HREF="http://hplyot.obspm.fr/~dl/">Laurent Demailly</A>

Roger Savard

unread,
May 5, 1995, 3:00:00 AM5/5/95
to
Not quite :-(

--
+---------------------------------------------------------+
| Roger Savard |
| ro...@centrcn.umontreal.ca Services Informatiques |

| Gestion des environnements Universite de Montreal |

+---------------------------------------------------------+


Joerg Petersen

unread,
May 5, 1995, 3:00:00 AM5/5/95
to
Roger Savard (sav...@centrcn.umontreal.ca) wrote:
: Hi,

: 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

Laurent Demailly

unread,
May 5, 1995, 3:00:00 AM5/5/95
to
Opsa, I wrote that stupid answer at Date: Fri May 05 04:13:10 METDST 1995
4 am is defintly not a good time for usenet post, i misread
Suspended (tty input) as Suspended (tty output)

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

Brian Starr

unread,
May 7, 1995, 3:00:00 AM5/7/95
to
In article <3odf2o$1c...@info4.rus.uni-stuttgart.de>,
pete...@s.pi1.physik.uni-stuttgart.de (Joerg Petersen) wrote:

> : 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.

bst...@ics.uci.edu

--
Brian

Dimitry Kloper

unread,
May 7, 1995, 3:00:00 AM5/7/95
to
Roger Savard (sav...@centrcn.umontreal.ca) wrote:
: Hi,

: 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


Roger Savard

unread,
May 8, 1995, 3:00:00 AM5/8/95
to
Hello, I found a solution for this/my problem, but first here is some
background: I used to start my application using IRIX's filemanager by
double-clicking on my app's icon. And then, after many weeks of developpement
I tried to launch it on a command line : "my_app &" and it was "stopped".

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 |

0 new messages