We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ea606d5 commit 599b68bCopy full SHA for 599b68b
teardown_env.sh
@@ -83,12 +83,9 @@ if [[ -z "${TARGET_DIR}" ]]; then
83
fi
84
85
# Real work
86
-status "Getting mounts in '${TARGET_DIR}'..."
87
-mounts=$(cat /proc/mounts | awk '{ system("echo \"" $2 "\"") }' | egrep "^${TARGET_DIR}" | tac)
88
-
89
-status "Unmounting chroot filesystems..."
90
-for x in $mounts; do
+status "Unmounting chroot filesystems in '${TARGET_DIR}'..."
+while IFS= read -r -d '' x; do
91
run umount "${x}"
92
-done
+done < <(cat /proc/mounts | tac | awk -vORS=$'\\0' '{ print $2 }' | xargs -0 -L1 printf '%b\0' | egrep --text --null-data "^${TARGET_DIR}")
93
94
status "Teardown complete"
0 commit comments