diff options
author | Edwin Cheng <[email protected]> | 2019-04-01 18:11:22 +0100 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2019-04-02 08:03:31 +0100 |
commit | b84d0fc1a307f6103ea2c2620a106db821696434 (patch) | |
tree | 99d158e992a58a07cbf51676add9784583b401c8 /editors/code/src/utils/terminateProcess.sh | |
parent | c894a3e19b0e658622a03a7d0539a78a433b42ae (diff) |
Add proper process teminate method
Diffstat (limited to 'editors/code/src/utils/terminateProcess.sh')
-rw-r--r-- | editors/code/src/utils/terminateProcess.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/editors/code/src/utils/terminateProcess.sh b/editors/code/src/utils/terminateProcess.sh new file mode 100644 index 000000000..2ec9e1c2e --- /dev/null +++ b/editors/code/src/utils/terminateProcess.sh | |||
@@ -0,0 +1,12 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | terminateTree() { | ||
4 | for cpid in $(pgrep -P $1); do | ||
5 | terminateTree $cpid | ||
6 | done | ||
7 | kill -9 $1 > /dev/null 2>&1 | ||
8 | } | ||
9 | |||
10 | for pid in $*; do | ||
11 | terminateTree $pid | ||
12 | done \ No newline at end of file | ||