mirror of
https://github.com/mum4k/termdash.git
synced 2026-04-27 03:15:55 +03:00
[GH-ISSUE #246] Background Execution #134
Labels
No labels
bug
cleanup
enhancement
enhancement
enhancement
good first issue
help wanted
help wanted
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/termdash#134
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @1995parham on GitHub (Oct 2, 2020).
Original GitHub issue: https://github.com/mum4k/termdash/issues/246
Is there any way to send a program to the background (with
ctrl + zfor example) then resume it? When I use this key combination on Linux nothing happens. Is there any suggestion for this?@keithknott26 commented on GitHub (Oct 2, 2020):
I normally run it inside a screen session which works fine when you open the session back up
@1995parham commented on GitHub (Oct 3, 2020):
By screen session, you mean something like
tmux?@keithknott26 commented on GitHub (Oct 3, 2020):
on a linux host you can (provided screen is installed) and type "screen" which will open a new terminal inside your terminal... run your program, and then hit ctrl + a then "d" for detach. Then your program will run in the background, when you're ready to return to it just type "screen -x "
@1995parham commented on GitHub (Oct 3, 2020):
Ok, I have got it.
tmuxis also like that. Thanks for mentioning. 👍 But in a case that I don't use it can we put it into the background?@mum4k commented on GitHub (Oct 4, 2020):
Hi @1995parham and thank you @keithknott26 for providing the useful hint.
The reason ctrl+z doesn't work is that the underlying terminal library (tcell or termbox) captures all keyboard input. So the ctrl+z that is pressed is captured by Termdash instead of making it to the underlying shell that would then suspend the application.
If I remember correctly, what ctrl+z does is that it instructs the shell to send SIGTSTP to the process to essentially suspend it.
We could emulate the behavior by defining ctrl+z as a shortcut at the Termdash level. For that, you could implement a keyboard subscriber that will react to this shortcut being pressed. The reaction could be that the Go program will send SIGTSTP to itself. There is some example code : this Go issue: https://github.com/golang/go/issues/776#
Please let me know if you would like more details or if you have further questions.