aboutsummaryrefslogtreecommitdiff
path: root/lib/System/Unix/Program.inc
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2009-09-08 19:50:27 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2009-09-08 19:50:27 +0000
commita607202a68085cee4d18894392be647d6cd4a53e (patch)
tree7638e037b222302c93a3706c4c1d790a02bccacc /lib/System/Unix/Program.inc
parent8e371aa7b623f6d1d62e8859df9d4134659bcd33 (diff)
Add a Kill() function to the Program class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81246 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix/Program.inc')
-rw-r--r--lib/System/Unix/Program.inc10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc
index fca9292382..fdd0c25fd1 100644
--- a/lib/System/Unix/Program.inc
+++ b/lib/System/Unix/Program.inc
@@ -283,6 +283,16 @@ Program::Wait(unsigned secondsToWait,
}
+bool
+Program::Kill(std::string* ErrMsg) {
+ if (Pid_ == 0) {
+ MakeErrMsg(ErrMsg, "Process not started!");
+ return true;
+ }
+
+ return (kill(Pid_, SIGKILL) == 0);
+}
+
bool Program::ChangeStdinToBinary(){
// Do nothing, as Unix doesn't differentiate between text and binary.
return false;