|
|
8a3219 |
From 818d297b17a55fc9c3b21784f45b23875501d654 Mon Sep 17 00:00:00 2001
|
|
|
8a3219 |
From: Eric Garver <eric@garver.life>
|
|
|
8a3219 |
Date: Mon, 17 Jun 2019 10:57:55 -0400
|
|
|
8a3219 |
Subject: [PATCH 04/20] test: new macro PIPESTATUS0
|
|
|
8a3219 |
|
|
|
8a3219 |
It's essentially a portable version of bash's PIPESTATUS[0]. It passes
|
|
|
8a3219 |
down the return code of the first command in the pipeline.
|
|
|
8a3219 |
|
|
|
8a3219 |
(cherry picked from commit 1c4bb9337f5d5c734a2a8bab10782423408d4026)
|
|
|
8a3219 |
---
|
|
|
8a3219 |
src/tests/functions.at | 8 ++++++++
|
|
|
8a3219 |
1 file changed, 8 insertions(+)
|
|
|
8a3219 |
|
|
|
8a3219 |
diff --git a/src/tests/functions.at b/src/tests/functions.at
|
|
|
8a3219 |
index 800dd92c7826..932e288f1597 100644
|
|
|
8a3219 |
--- a/src/tests/functions.at
|
|
|
8a3219 |
+++ b/src/tests/functions.at
|
|
|
8a3219 |
@@ -242,6 +242,14 @@ m4_define([NS_CHECK], [
|
|
|
8a3219 |
AT_CHECK([NS_CMD([$1])], [$2], [$3], [$4], [$5], [$6])
|
|
|
8a3219 |
])
|
|
|
8a3219 |
|
|
|
8a3219 |
+dnl implement PIPESTATUS[0] in a portable way
|
|
|
8a3219 |
+dnl
|
|
|
8a3219 |
+m4_define([PIPESTATUS0], [dnl
|
|
|
8a3219 |
+ sh <<-"HERE"
|
|
|
8a3219 |
+ { { { { $1; echo $? >&3; } | $2 >&4; } 3>&1; } | { read RC; exit $RC; } } 4>&1
|
|
|
8a3219 |
+HERE
|
|
|
8a3219 |
+])
|
|
|
8a3219 |
+
|
|
|
8a3219 |
m4_define([EBTABLES_LIST_RULES], [
|
|
|
8a3219 |
dnl ebtables commit 5f508b76a0ce change list output for inversion.
|
|
|
8a3219 |
m4_define([EBTABLES_LIST_RULES_NORMALIZE], [[sed -e 's/\([-][-][-a-zA-Z0-9]\+\)[ ]\+[!]/! \1/g']])
|
|
|
8a3219 |
--
|
|
|
8a3219 |
2.20.1
|
|
|
8a3219 |
|