[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fwd: Re: job control for the es shell]
Paul Haahr wrote:
> (1) Correct job control in es requires some notion of (internal-to-es)
> thread (or process or ...) that can be stopped and started.
Indeed. The only stoppable objects in my patch are forked processes
(process groups).
> (2) The right way to implement threads in es is using first class
> continuations (e.g., call/cc).
It would be much easier, if unix had rich return values. Then a simple
fork will allmost do the trick. Allmost ...
> What do I mean by ``correct''? Basically, that es commands can be
> seemlessly interrupted and restarted regardless of whether they're
> running within the shell or in forked processes. I only tried your
> patch very quickly, but it doesn't appear to satisfy that criteria.
No, it doesn't. Unfortunately.
> For examples, try interrupting (& restarting) things like
> while true { sleep 1 }
> while true { echo t }
> x = `{ date; sleep 100; date }
How do other shells do job control on those examples?
Ksh88:
Ksh simply disables job control for command sequences! A simple approach,
but clean and predictable.
bash2.0:
Pressing ^Z or ^C has the expected result on all external processes in a
sequence of commands. Any intenal (to bash) command is interrupted and not
restartable.
But there are bugs, too. Try to stop and then kill the following:
echo $(sleep 9999|sleep 9999)
mypatch:
I have put a new version of the patch with several bugfixes on my web page:
http://theorie1.physik.uni-erlangen.de/rogalsky/es
It's still not fully tested, but at least the first two examples of yours
are now interruptable. The last example only examplifies, that my patch
isn't ``correct''.
Thanks for your tests,
Olaf
--
+----------------------------------------------------------------------+
I Dipl. Phys. Olaf Rogalsky Institut f. Theo. Physik I I
I Tel.: 09131 8528440 Univ. Erlangen-Nuernberg I
I Fax.: 09131 8528444 Staudtstrasse 7 B3 I
I rogalsky@theorie1.physik.uni-erlangen.de D-91058 Erlangen I
+----------------------------------------------------------------------+