EmilyDirsh / hotwire-shell

Automatically exported from code.google.com/p/hotwire-shell
Other
0 stars 0 forks source link

Ctrl-shift-c loses some ping output #157

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Type "ping www.bbc.co.uk"
2. Let it ping a couple of times
3. Press Ctrl-Shift-C

What is the expected output? What do you see instead?
Expect

PING www.bbc.net.uk (212.58.251.202) 56(84) bytes of data.
64 bytes from www2.telhc.bbc.co.uk (212.58.251.202): icmp_seq=1 ttl=244
time=29.0 ms
64 bytes from www2.telhc.bbc.co.uk (212.58.251.202): icmp_seq=2 ttl=244
time=17.6 ms
64 bytes from www2.telhc.bbc.co.uk (212.58.251.202): icmp_seq=3 ttl=244
time=23.2 ms
64 bytes from www2.telhc.bbc.co.uk (212.58.251.202): icmp_seq=4 ttl=244
time=13.0 ms

--- www.bbc.net.uk ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2999ms
rtt min/avg/max/mdev = 13.035/20.753/29.012/5.994 ms

And in fact we only see

PING www.bbc.net.uk (212.58.251.202) 56(84) bytes of data.
64 bytes from www2.telhc.bbc.co.uk (212.58.251.202): icmp_seq=1 ttl=244
time=14.2 ms
64 bytes from www2.telhc.bbc.co.uk (212.58.251.202): icmp_seq=2 ttl=244
time=12.1 ms
64 bytes from www2.telhc.bbc.co.uk (212.58.251.202): icmp_seq=3 ttl=244
time=13.8 ms
64 bytes from www2.telhc.bbc.co.uk (212.58.251.202): icmp_seq=4 ttl=244
time=168 ms

What version of the product are you using? On what operating system?

SVN latest (0.711)

Original issue reported on code.google.com by dmi...@gmail.com on 29 Feb 2008 at 6:01

GoogleCodeExporter commented 9 years ago
This one occurs because we send SIGKILL (-9) to subprocesses on Ctrl-Shift-C, 
whereas
a terminal sends SIGINT.  The difference is that some applications have special
handling for SIGINT (and ping is one of them).  

Originally, we were sending SIGINT.  The difficulty here is that allowing 
processes
to continue on after receiving SIGINT clashed a bit with the Hotwire pipeline 
model,
where pipelines can be either running or not; there is no in-between.

I think if we wanted to fix this well, we need a more complex state machine in
hotwire/command.py.  Currently there's just "running" and "cancelled" that are
relevant here.  But to do this right, we'd need "running",
"running-cancel-requested", and "cancelled".  From "running", we send SIGINT, 
then
change to "running-cancel-requested".  Only once the builtin sends back that 
it's
successfully cancelled do we go from "running-cancel-requested" to "cancelled".

Original comment by cgwalt...@gmail.com on 29 Feb 2008 at 9:38

GoogleCodeExporter commented 9 years ago
I think this is a pretty huge problem... Ctrl-Shift-C needs to send SIGINT, by 
default.

Why must Hotwire keep track of the fact that SIGINT was sent to the process? 
The 
processing is "running" when it's running, and it should be considered 
"cancelled" 
when it exits.

If you want some other button that sends SIGKILL for terminating processes that 
aren't playing nice, then that's fine. But it certainly shouldn't be default 
behavior.

I guess I just don't understand why the Hotwire model needs to change in order 
to 
switch to using SIGINT instead of SIGKILL. Instead of changing state to 
"cancelled" 
when C-Shift-C is *pressed*, it could simply do that when the child process 
exits.

Original comment by terat...@gmail.com on 6 Oct 2008 at 9:59