about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDhruv Maroo <dhruvmaru007@gmail.com>2021-11-08 01:46:53 +0530
committerDhruv Maroo <dhruvmaru007@gmail.com>2021-11-08 01:46:53 +0530
commitd92d1e568536518132d4ef4cb4121638ff38969e (patch)
tree9e40fd1f9233969d51ddcf8a22ada1e35087f15b
parent3483715789beee1bacca26a65ab215b3d51e8b34 (diff)
downloadafl++-d92d1e568536518132d4ef4cb4121638ff38969e.tar.gz
Use FIFOs instead of hacky sleep code to pass messages
-rwxr-xr-xafl-plot11
1 files changed, 6 insertions, 5 deletions
diff --git a/afl-plot b/afl-plot
index 1ea1fc55..03be2e91 100755
--- a/afl-plot
+++ b/afl-plot
@@ -196,14 +196,15 @@ exit 1
 fi
 
 mkdir -p "$outputdir/tmp"
+mkfifo "$outputdir/tmp/win_ids"
 afl-plot-ui > "$outputdir/tmp/win_ids" &
 
-sleep 0.5
+W_IDS=$(cat $outputdir/tmp/win_ids)
 
-W_ID1=$(cat $outputdir/tmp/win_ids | head -1)
-W_ID2=$(cat $outputdir/tmp/win_ids | head -2 | tail -1)
-W_ID3=$(cat $outputdir/tmp/win_ids | head -3 | tail -1)
-W_ID4=$(cat $outputdir/tmp/win_ids | tail -1)
+W_ID1=$(echo "$W_IDS" | head -1)
+W_ID2=$(echo "$W_IDS" | head -2 | tail -1)
+W_ID3=$(echo "$W_IDS" | head -3 | tail -1)
+W_ID4=$(echo "$W_IDS" | tail -1)
 
 echo "[*] Generating plots..."