diff options
author | van Hauser <vh@thc.org> | 2021-11-08 09:41:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-08 09:41:14 +0100 |
commit | 7dcaf64eed9186add61ec19758a3687bda742d04 (patch) | |
tree | 5edb3a0ccf66e26115d93712990763d4b4d51f41 /afl-plot | |
parent | 3483715789beee1bacca26a65ab215b3d51e8b34 (diff) | |
parent | c94f07bfdfd052d18cc02ab9977a539e6e64734f (diff) | |
download | afl++-7dcaf64eed9186add61ec19758a3687bda742d04.tar.gz |
Merge pull request #1149 from DMaroo/ui-fifo
Use FIFOs instead of hacky sleep code to pass messages in afl-plot
Diffstat (limited to 'afl-plot')
-rwxr-xr-x | afl-plot | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/afl-plot b/afl-plot index 1ea1fc55..1029d5a0 100755 --- a/afl-plot +++ b/afl-plot @@ -195,15 +195,22 @@ exit 1 fi -mkdir -p "$outputdir/tmp" -afl-plot-ui > "$outputdir/tmp/win_ids" & +mkdir -p "$outputdir/.tmp" +rm -f "$outputdir/.tmp/win_ids" +mkfifo "$outputdir/.tmp/win_ids" || exit 1 -sleep 0.5 +afl-plot-ui > "$outputdir/.tmp/win_ids" & +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) +rm -f "$outputdir/.tmp/win_ids" +if [ -z "$(ls -A $outputdir/.tmp)" ]; then + rm -rf "$outputdir/.tmp" +fi + +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..." @@ -265,12 +272,6 @@ _EOF_ sleep 1 -rm "$outputdir/tmp/win_ids" - -if [ -z "$(ls -A $outputdir/tmp)" ]; then - rm -r "$outputdir/tmp" -fi - else echo "[*] Generating plots..." |