[mutter] tests/virtme-run: Create fake stdin



commit 4ce233b89ef9986f8c164ae31b88e2b2e0e5e3ba
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Wed Feb 9 10:50:43 2022 +0100

    tests/virtme-run: Create fake stdin
    
    When running in CI, the stdin may be /dev/null, which causes issues
    for qemu. Avoid this issue by creating our own fake stdin.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2152>

 src/tests/kvm/virtme-run.sh | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/tests/kvm/virtme-run.sh b/src/tests/kvm/virtme-run.sh
index ec05f913c8..3b9fda63f7 100755
--- a/src/tests/kvm/virtme-run.sh
+++ b/src/tests/kvm/virtme-run.sh
@@ -20,6 +20,12 @@ XDG_DATA_DIRS=$XDG_DATA_DIRS \
 $VM_ENV \
 "
 
+if [[ "$(stat -c '%t:%T' -L /proc/$$/fd/0)" == "0:0" ]]; then
+  mkfifo $XDG_RUNTIME_DIR/fake-stdin.$$
+  exec 0<> $XDG_RUNTIME_DIR/fake-stdin.$$
+  rm -f $XDG_RUNTIME_DIR/fake-stdin.$$
+fi
+
 virtme-run \
   --memory=256M \
   --rw \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]