From ba6f6bc4774935f1d0fbcaa7341952705e5512c5 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 18 May 2018 15:22:33 +0100
Subject: [PATCH] wrap: Respect --interactive even when bwrap doesn't work

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 pressure-vessel-wrap | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/pressure-vessel-wrap b/pressure-vessel-wrap
index 0b531a291..f3a8eeb0f 100755
--- a/pressure-vessel-wrap
+++ b/pressure-vessel-wrap
@@ -252,6 +252,16 @@ if [ -n "$verbose" ]; then
     env | sed -e 's/^/\t/' >&2
 fi
 
+if [ -n "$interactive" ]; then
+    exec </dev/tty
+    exec >/dev/tty
+    exec 2>/dev/tty
+    echo "$me: Starting interactive shell (original command is in \"\$@\")">&2
+    wrapped_command=(bash -i -s "$@")
+else
+    wrapped_command=("$@")
+fi
+
 if [ -z "$BWRAP" ] || ! "$BWRAP" --bind / / true; then
     echo "$me: cannot find bwrap or it doesn't work, falling back to executing '$*' directly" >&2
 
@@ -269,7 +279,7 @@ if [ -z "$BWRAP" ] || ! "$BWRAP" --bind / / true; then
         unset LD_LIBRARY_PATH
     fi
 
-    exec "$@"
+    exec "${wrapped_command[@]}"
 fi
 
 if "$BWRAP" --help | grep -F '[--]' 2>/dev/null; then
@@ -294,16 +304,6 @@ else
     esac
 fi
 
-if [ -n "$interactive" ]; then
-    exec </dev/tty
-    exec >/dev/tty
-    exec 2>/dev/tty
-    echo "$me: Starting interactive shell (original command is in \"\$@\")">&2
-    wrapped_command=(bash -i -s "$@")
-else
-    wrapped_command=("$@")
-fi
-
 if [ -z "$fake_home" ]; then
     if [ -n "${SteamAppId:-}" ]; then
         fake_home="$HOME/.var/app/com.steampowered.App$SteamAppId"
-- 
GitLab