summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildscripts/cleanbb.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/buildscripts/cleanbb.py b/buildscripts/cleanbb.py
index 261519a4977..bfeafd2d8e9 100644
--- a/buildscripts/cleanbb.py
+++ b/buildscripts/cleanbb.py
@@ -1,13 +1,15 @@
import sys
-import os
+import os, os.path
import utils
import time
from optparse import OptionParser
-cwd = os.getcwd();
-if cwd.find("buildscripts" ) > 0 :
- cwd = cwd.partition( "buildscripts" )[0]
+# set cwd to the root mongo dir, one level up from this
+# file's location (if we're not already running from there)
+cwd = os.getcwd()
+if os.path.basename(cwd) == 'buildscripts':
+ cwd = os.path.dirname(cwd)
print( "cwd [" + cwd + "]" )
@@ -38,7 +40,7 @@ def killprocs( signal="" ):
if not shouldKill( x ):
continue
- pid = x.partition( " " )[0]
+ pid = x.split( " " )[0]
print( "killing: " + x )
utils.execsys( "/bin/kill " + signal + " " + pid )
killed = killed + 1