[vlc-devel] [PATCH 1/2] pkg-static.sh: improve I/O redirects

Robert Mourning robedmo.git at gmail.com
Fri Jun 2 03:09:33 CEST 2017


Redirecting I/O for each command instead of redirecting
files to stdin/stdout allows overwriting those files
without needing to close the corresponding file descriptors
to build on Windows Subsystem for Linux (from DrvFs).

---
 contrib/src/pkg-static.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/contrib/src/pkg-static.sh b/contrib/src/pkg-static.sh
index 59cbd78..d7ec8c2 100755
--- a/contrib/src/pkg-static.sh
+++ b/contrib/src/pkg-static.sh
@@ -8,13 +8,13 @@ if test -z "$1" || test -n "$2"; then
 	exit 1
 fi
 
-exec <"$1" >"$1.tmp" || exit $?
-
 LIBS_PUBLIC=""
 LIBS_PRIVATE=""
 REQUIRES_PUBLIC=""
 REQUIRES_PRIVATE=""
 
+TEMP_FILE="$1.tmp"
+
 while read LINE; do
 	lpub="${LINE#Libs:}"
 	lpriv="${LINE#Libs.private:}"
@@ -31,8 +31,8 @@ while read LINE; do
 	else
 		echo "$LINE"
 	fi
-done
-echo "Libs: $LIBS_PUBLIC $LIBS_PRIVATE"
-echo "Requires: $REQUIRES_PUBLIC $REQUIRES_PRIVATE"
+done <"$1" >"$TEMP_FILE"
+echo "Libs: $LIBS_PUBLIC $LIBS_PRIVATE" >>"$TEMP_FILE"
+echo "Requires: $REQUIRES_PUBLIC $REQUIRES_PRIVATE" >>"$TEMP_FILE"
 
-mv -f -- "$1.tmp" "$1"
+mv -f -- "$TEMP_FILE" "$1"
-- 
2.7.4



More information about the vlc-devel mailing list