[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: cadet/loopcheck.sh: still b
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: cadet/loopcheck.sh: still bash, leaving only PIPESTATUS |
Date: |
Sat, 09 Mar 2019 12:26:13 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new cc372c342 cadet/loopcheck.sh: still bash, leaving only PIPESTATUS
cc372c342 is described below
commit cc372c3427454e52763b22461fd3af1aaaf295d3
Author: ng0 <address@hidden>
AuthorDate: Sat Mar 9 11:26:07 2019 +0000
cadet/loopcheck.sh: still bash, leaving only PIPESTATUS
---
src/cadet/loopcheck.sh | 42 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 40 insertions(+), 2 deletions(-)
diff --git a/src/cadet/loopcheck.sh b/src/cadet/loopcheck.sh
index ddc8c191c..9b867e95b 100755
--- a/src/cadet/loopcheck.sh
+++ b/src/cadet/loopcheck.sh
@@ -1,4 +1,41 @@
-#!/bin/sh
+#!/usr/bin/env bash
+# This script is in the public domain
+# POSIX shell solution for named pipes and pipestatus,
+# http://shell.cfajohnson.com/cus-faq-2.html#Q11
+# run() {
+# j=1
+# while eval "\${pipestatus_$j+:} false"; do
+# unset pipestatus_$j
+# j=$(($j+1))
+# done
+# j=1 com= k=1 l=
+# for a; do
+# if [ "x$a" = 'x|' ]; then
+# com="$com { $l "'3>&-
+# echo "pipestatus_'$j'=$?" >&3
+# } 4>&- |'
+# j=$(($j+1)) l=
+# else
+# l="$l \"\$$k\""
+# fi
+# k=$(($k+1))
+# done
+# com="$com $l"' 3>&- >&4 4>&-
+# echo "pipestatus_'$j'=$?"'
+# exec 4>&1
+# eval "$(exec 3>&1; eval "$com")"
+# exec 4>&-
+# j=1
+# while eval "\${pipestatus_$j+:} false"; do
+# eval "[ \$pipestatus_$j -eq 0 ]" || return 1
+# j=$(($j+1))
+# done
+# return 0
+# }
+
+# # https://mywiki.wooledge.org/Bashism has another solution:
+# # mkfifo fifo; command2 <fifo & command1 >fifo; echo "$?"
+
while true; do
if [ "$1" = "" ]; then
echo All
@@ -7,6 +44,7 @@ while true; do
echo One
LOGFILE="test_`date "+%m.%d-%H:%M:%S"`.log"
taskset 01 $1 2>&1 | tee $LOGFILE | grep -v DEBUG;
+ # TODO: Replace $PIPESTATUS with more portable code
if [ "${PIPESTATUS[0]}" != "0" ]; then
echo "Failed";
date;
@@ -15,5 +53,5 @@ while true; do
fi
grep cadet test_*.log | grep -B 10 ERROR && break
grep cadet test_*.log | grep -B 10 Assert && break
- ls core* &> /dev/null && break
+ ls core* > /dev/null 2>&1 && break
done
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: cadet/loopcheck.sh: still bash, leaving only PIPESTATUS,
gnunet <=