evans icon indicating copy to clipboard operation
evans copied to clipboard

Ctrl+c does not abort during server-side stream

Open bartslinger opened this issue 3 years ago • 5 comments

Describe the bug

When I call a (long-lived) server-side stream, I cannot cancel or stop the program by pressing ctrl+c. This used to work until version 0.10.0, but is broken since 0.10.1.

To reproduce

Call a server-side stream and press ctrl+c

Expected behavior

The program shuts down

Environment

  • OS: ubuntu 21.10
  • Terminal: bash/zsh/sh
  • Evans version: 10.1/10.2
  • protoc version: 3.12.4

bartslinger avatar Feb 19 '22 09:02 bartslinger

This is maybe caused by c-bata/go-prompt, a dependent library. However, we still need to dig down to find the root cause.

ktr0731 avatar Mar 12 '22 08:03 ktr0731

I'm not sure if this is related but I noticed that in my shell, if I launch the evans REPL and exit it (with ^d) ^c stops working in my terminal until I call reset.

This is all that's needed for a repro

# This should work
% # hello, pressing ctrl+c

# Now launch evans with any proto and exit (`^d`)
% evans some.proto
[...]
127.0.0.1:50051>
Good Bye :)

# Now try the first line again, `^c` is not working:
% # hello, pressing ctrl+c

macOS 12.2 (arm), zsh 5.8, evans 0.10.4

bombsimon avatar Apr 07 '22 08:04 bombsimon

The issue with ^c not working after using the repl is fixed for me since 0.10.6. I have not tested the original problem though. Since my previous comment I've also updated oh-my-zsh and installed a newer version of bash in PATH so this might very well have been the solution as well. Anyhow, just wanted to add that my issue does no longer exist.

bombsimon avatar Apr 27 '22 14:04 bombsimon

@bombsimon Thanks for the report! The issue that you reported is related to the version of c-bata/go-prompt. The library is updated to a newer one in https://github.com/ktr0731/evans/pull/528, so this problem is fixed.

FYI: the original issue is not related to this problem.

ktr0731 avatar Apr 29 '22 12:04 ktr0731

The current version (0.10.9) exits on ctrl+c. This causes the user have to re-run the repl. An alternative would be to cancel the context on the signal, which is a similar behaviour for bidi streams.

If you agree that this would be a useful change, I can make PR.

HeinKalido avatar Feb 16 '23 17:02 HeinKalido