qubes.ShowInTerminal 407 B

12345678910111213141516171819
  1. #!/bin/bash --
  2. set -eu
  3. tmpdir="$(mktemp -d)"
  4. if [[ $tmpdir =~ \" ]]; then
  5. echo 'Error: non admissible character detected in sock path.'
  6. exit 1
  7. fi
  8. sock="$tmpdir/terminal.sock"
  9. xterm -geometry 80x24 -e /bin/sh -c "
  10. until [ -S $sock ]; do sleep 0.1; done || true
  11. exec socat file:/dev/tty,rawer,escape=0x0f UNIX-CONNECT:$sock" &
  12. trap 'rm -rf -- "$tmpdir"' EXIT
  13. socat "UNIX-LISTEN:\"$sock\"" -
  14. wait