erl; Linux; and tty reset

Ulf Wiger ulf.wiger@REDACTED
Wed Apr 21 09:29:47 CEST 1999

knotwell@REDACTED 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.
** 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.

Ulf Wiger, Chief Designer AXD 301     <ulf.wiger@REDACTED>
Ericsson Telecom AB                          tfn: +46  8 719 81 95
Varuvägen 9, Älvsjö                          mob: +46 70 519 81 95
S-126 25 Stockholm, Sweden                   fax: +46  8 719 43 44

More information about the erlang-questions mailing list