Browse Source

printcontenv must return an error on nonexistent var in all cases

Signed-off-by: Laurent Bercot <[email protected]>
Laurent Bercot 3 years ago
parent
commit
5d3719862f

+ 6 - 1
layout/rootfs-overlay/package/admin/s6-overlay-@VERSION@/command/printcontenv

@@ -6,7 +6,12 @@ if test "$#" -eq 0 ; then
 fi
 
 if test "0$S6_KEEP_ENV" -ne 0 ; then
-  eval s6-echo -- \$$1
+  eval var=\$$1
+  if test -z "$var" ; then
+    return 1
+  else
+    exec s6-echo -- "$var"
+  fi
 else
   exec 2>/dev/null
   s6-cat < "/run/s6/container_environment/$1" && echo