Add create/kill background process#8
Conversation
|
Somewhat related to #1 , although with no logging |
|
One improvement i would like to add is the following: |
|
Improvements added:
|
| if (command.ExitStatus == 0) | ||
| { | ||
| Log.Debug($"Gracefully killed PID={pid}"); | ||
| BackgroundProcesses.Remove(pid); | ||
| return true; | ||
| } |
There was a problem hiding this comment.
This exit status doesn't check if the background process exited. It checks if the kill command successfully sent the SIGTERM signal to the process. If the process ignores the signal, or doesn't handle it (because it's hanging for example) then kill will still return 0 without exiting the process
The current implementation of the SSH plugin only allows to run comands in place, blocking the flow execution.
While SSH commands can be started in a parallel branch, stopping them is not trivial.
Possible use cases are:
This pull request addresses this by running processes in nohup mode. In this way, processes can continue running on the remote machine even after the completion of the test step.
The step yields as output the PID of the background process.
Later, whenever the user wants (e.g., after a delay or whenever a set of steps terminate), the background process can be killed.
The target PID is used as input.
Example
sleep 30Possible issues