You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
Pull Request resolved: #545
### Context
Currently the `kill_process` action in TTPForge in cases of failure like `Couldn't find process` and `Couldn't kill process` by default throws an exception which leads to TTP being stopped. While this could be a valid usecase in some situations, allowing user control on whether to throw an error or to print an error and return normally helps make the code versatile.
Following is the decision making in the initial commit of Kill Process Action: [link](https://app.diagrams.net/#G1A4S3RgNffbaMbp40RCpqvmprH1QQvVvi#%7B%22pageId%22%3A%22CNsj_rZLfA5pAP3afiLK%22%7D)
https://pxl.cl/7Lcn3
This flow diagram shows the updated decision making: [link](https://app.diagrams.net/?title=Kill%20Process%20Updated%20Decision%20making.drawio&client=1#G1TePfzl48hKjTKe-K-efOH8F-ASMror7j#%7B%22pageId%22%3A%22CNsj_rZLfA5pAP3afiLK%22%7D)
https://pxl.cl/7Lcmh
### Changes
* **Code Improvements**: The `kill_process` step has been updated to receive user inputs on actions to take in case of failures like `error_on_find_process_failure` and `error_on_kill_failure`. This facilitates increased control on the code flow by the user to satisfy different needs.
* **Documentation**: Added an example TTP for reference on the use of the new user inputs for the step `kill_process`.
* **Testing**: Additional test cases have been added to verify the functionality of the added flags on the `kill_process` step.
### Impact
* **Improved Usability**: The changes in this diff make it easier for users to control the output of the step on the basis of their needs. (Ignoring or throwing exceptions in cases of failure)
Reviewed By: d0n601
Differential Revision: D78521586
fbshipit-source-id: 4014f0d31ad13fa90c4183d680ca858d40fc56a9
Copy file name to clipboardExpand all lines: docs/foundations/actions/kill_process.md
+8-1Lines changed: 8 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,8 @@
3
3
The `kill_process` action can be used to terminate processes running on a system.
4
4
Check out the TTP below to see how it works:
5
5
6
-
<!-- TODO: Link to add for example TTP after code is landed -->
6
+
[Kill Process Unix](https://github.com/facebookincubator/TTPForge/blob/0deabc567751d90078e5db3c2a84574396b43dc1/example-ttps/actions/kill-process/kill-process-unix.yaml)
7
+
[Kill Process Windows](https://github.com/facebookincubator/TTPForge/blob/0deabc567751d90078e5db3c2a84574396b43dc1/example-ttps/actions/kill-process/kill-process-windows.yaml)
7
8
8
9
You can experiment with the above TTP by installing the `examples` TTP
9
10
repository (skip this if `ttpforge list repos` shows that the `examples` repo is
@@ -27,10 +28,16 @@ You can specify the following YAML fields for the `kill_process:` action:
27
28
you wish to kill
28
29
-`kill_process_name:` (type: `string`) the process name of the process that
29
30
you wish to kill
31
+
-`error_on_find_process_failure:` (type: `bool`) whether to raise an error if
32
+
finding the process name/id fails
33
+
-`error_on_kill_failure:` (type: `bool`) whether to raise an error if killing
34
+
the process fails
30
35
31
36
## Additional Notes
32
37
33
38
If both `kill_process_id` and `kill_process_name` are specified, the action
34
39
will only consider process ID as long as it is valid.
35
40
If an invalid `kill_process_id` is specified, the action will fall back to
36
41
using `kill_process_name` to kill the processes.
42
+
Both the flags `error_on_find_process_failure` and `error_on_kill_failure` are
0 commit comments