ov icon indicating copy to clipboard operation
ov copied to clipboard

Ctrl-Z Does Not Suspend ov Properly, Instead Launches a Subshell

Open yosagi opened this issue 1 year ago • 2 comments

Expected Behavior: When pressing Ctrl-Z, the ov process should be suspended, allowing the user to return to the shell that launched ov. In this shell, using the fg command should resume the ov process. This behavior should also apply when ov is used in a pipeline, such as in cat hoge | ov, or with commands like man or bat.

Actual Behavior: Pressing Ctrl-Z launches a subshell specified by the SHELL environment variable as a child process of the ov process. To return to ov, the user must exit this new subshell. However, this results in the loss of command history in the subshell, and no jobs are shared with the parent shell. Additionally, when ov is used within a pipeline, it cannot be properly suspended and instead resumes immediately.

Suggestion: Please refer to the implementation of the suspend function in less for guidance on achieving the expected behavior: less signal.c implementation.

Tested on: Ubuntu 22.04 go version go1.21.2 linux/amd64 [email protected]

yosagi avatar Sep 27 '24 06:09 yosagi

Thank you for Issue. I thought there was a problem when I sent signal, but it worked now. I will change it.

noborus avatar Sep 27 '24 07:09 noborus

The default has been changed to not use subshell on platforms other than Windows.

noborus avatar Oct 17 '24 23:10 noborus

Thank you for your response. I have confirmed that it is using suspend instead of a subshell. I verified that on the master branch, ov suspends as expected when used alone. However, when used in a pipeline, the upstream process does not suspend and seems to get stuck. I'm not very familiar with the details, but I think it might be necessary to unmask SIGTSTP and send SIGTSTP instead of SIGSTOP. It seems that less handles it this way. I tested on bash, zsh, fish and tcsh on Ubuntu22.04.

yosagi avatar Oct 24 '24 10:10 yosagi

Thank you so much. I fixed it in #639.

noborus avatar Oct 25 '24 08:10 noborus

Thank you. It worked as expected on the send-process-group branch. I can now use it in my regular workflow.

yosagi avatar Oct 25 '24 09:10 yosagi

Thank you. It worked as expected on the send-process-group branch. I can now use it in my regular workflow.

Thank you for the wonderful report!

noborus avatar Oct 25 '24 10:10 noborus

I will Close because it was released. thank you.

noborus avatar Nov 11 '24 03:11 noborus