Erlang Mailing Lists

Author Message

<  Erlang questions mailing list  ~  erl; Linux; and tty reset

knotwell at f5.com
Posted: Tue Apr 20, 1999 11:08 pm Reply with quote
Guest
Hello all--

I wrote a small program (many thanks to the author of the urlget
module). I run it from the command line with the following command:

erl -s htmlhammer start # # URL -s erlang halt

This seems to work okay except for one minor annoyance--every time erl
"halts", the pseudo-terminal get "hosed up" and I need to do a reset or
stty sane to fix it.

It's not critical, but I was wondering if there was anyway around this
problem. The only other thing I've ever seen do this (_very_
periodically) is a botched xemacs startup when using the -nw option.

Another minor question: is there a module performing the common (I
presume) idiom of:

list_to_integer(atom_to_list('numeric_atom_here'))
%%IOW, is there an

--Brad





Post generated using Mail2Forum (http://m2f.sourceforge.net)
dne at mayonnaise.net
Posted: Wed Apr 21, 1999 12:40 am Reply with quote
Guest
knotwell_at_f5.com writes:

> This seems to work okay except for one minor annoyance--every time erl
> "halts", the pseudo-terminal get "hosed up" and I need to do a reset or
> stty sane to fix it.

Yes, I'm experiencing this problem too. If you terminate the shell by
doing "Ctrl-G q" or by executing "halt().", the tty stays "insane" and
has to be manually restored. Quitting by "Ctrl-C a", restores the tty
correctly.


Regards,
/Daniel

--
Daniel Neri
dne_at_mayonnaise.net


Post generated using Mail2Forum (http://m2f.sourceforge.net)
ulf.wiger at etxb.ericsso
Posted: Wed Apr 21, 1999 7:30 am Reply with quote
Guest
knotwell_at_f5.com wrote:
>
> Hello all--
>
> I wrote a small program (many thanks to the author of the urlget
> module). I run it from the command line with the following command:
>
> erl -s htmlhammer start # # URL -s erlang halt
>
> This seems to work okay except for one minor annoyance--every time erl
> "halts", the pseudo-terminal get "hosed up" and I need to do a reset or
> stty sane to fix it.

You could try init:stop() instead of erlang:halt(). It's less brutal.
Another problem you might run into is that the halt() command comes too
soon. Your function might be written such that it doesn't release the
thread before it's done. Then you avoid the problem.

One thing you could try is to write a synchronous function, one which
doesn't return until the operation is finished. Then you pipe it into an
erlang shell:

$ > echo 'io:format("hello.~n",[]).' | erl -boot start_clean
Eshell V4.7.1 (abort with ^G)
1> hello.
ok
** Terminating erlang **
$ >

When the shell reaches ^D, it terminates the shell automatically.


Another option is erl_call (I don't know if it works on all platforms.)

$ > setenv FOO `erl_call -s -name foo -a 'erlang localtime []'`
$ > echo $FOO
1999 4 21 9 28 11
$ > erl_call -q -name foo


> It's not critical, but I was wondering if there was anyway around this
> problem. The only other thing I've ever seen do this (_very_
> periodically) is a botched xemacs startup when using the -nw option.
>
> Another minor question: is there a module performing the common (I
> presume) idiom of:
>
> list_to_integer(atom_to_list('numeric_atom_here'))
> %%IOW, is there an

No, no such module.

/Uffe
--
Ulf Wiger, Chief Designer AXD 301 <ulf.wiger_at_etxb.ericsson.se>
Ericsson Telecom AB tfn: +46 8 719 81 95
Varuv
seb at erix.ericsson.se
Posted: Wed Apr 21, 1999 1:57 pm Reply with quote
Guest
knotwell_at_f5.com writes:
...
> This seems to work okay except for one minor annoyance--every time erl
> "halts", the pseudo-terminal get "hosed up" and I need to do a reset or
> stty sane to fix it.
...

Yes

This my fault and I should be shot for messing it up. In my work to
make the system portable I cleaned up all calls to atexit() in the
emulator (well there was only one, and it was the one which cleans up
the terminal settings). I thought that I had replaced it with a call
to another "atexit type" function, but it turns out that it is never
called before exit.

I will fix it, add it to the FAQ and it will be in the next release...

-- Sebastian

PS.
If you use tcsh, which I do, you don't notice this since tcsh is
forgiving (smart?) enough to reset your terminal to a nice state...
(Which is my excuse for letting this whole thing slip through our
testing.)


Post generated using Mail2Forum (http://m2f.sourceforge.net)

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum