From d4b2e100a35cb877327e38260fc5f7842523d9ed Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 7 Feb 2009 15:47:07 +0100 Subject: [PATCH] Improved detection if buildspy is already running. Added some commands to run buildspy manually. --- tools/make-buildspy | 8 +++++--- tools/make-interactive | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/tools/make-buildspy b/tools/make-buildspy index 7ae3591d7..41d0f0aac 100755 --- a/tools/make-buildspy +++ b/tools/make-buildspy @@ -20,6 +20,7 @@ ############################################################################### BUILD_SPY_FILENAME=$BASEDIR/.build_spy +BUILD_SPY_PID=$BUILD_SPY_FILENAME.pid build_spy() { local COMMAND @@ -48,10 +49,11 @@ build_spy_send_profile() { } if [ "$(basename $0)" == "make-buildspy" ]; then - if ps aux | grep -q [m]ake-buildspy; then - # Build spy is already running. Exiting silently. + if [ -f "$BUILD_SPY_PID" ]; then exit 0 fi + echo $$ > $BUILD_SPY_PID + while true; do DATA+=$(cat $BUILD_SPY_FILENAME 2>/dev/null || true) > $BUILD_SPY_FILENAME @@ -77,5 +79,5 @@ if [ "$(basename $0)" == "make-buildspy" ]; then sleep 10 done - rm -f $BUILD_SPY_FILENAME + rm -f $BUILD_SPY_FILENAME $BUILD_SPY_PID fi diff --git a/tools/make-interactive b/tools/make-interactive index 2ceb64468..1fff16e5d 100644 --- a/tools/make-interactive +++ b/tools/make-interactive @@ -65,6 +65,21 @@ batch) esac ;; +buildspy|bs) + # control buildspy + case "$2" in + start) + build_spy start + ;; + stop) + build_spy exit + ;; + *) + usage + ;; + esac + ;; + ccache) # ccache options case "$2" in -- 2.39.2