Use file descriptor instead of sleep to keep input pipe open

This commit is contained in:
Kristóf Tóth 2020-05-23 01:08:23 +02:00
parent 6a89682d5f
commit 69fac8189a

View File

@ -11,24 +11,24 @@ setup() {
bridge-cli bridge-cli
echo "login" > $INPIPE echo "login" >&3
echo "$BRIDGE_USER" > $INPIPE echo "$BRIDGE_USER" >&3
echo "$BRIDGE_PASS" > $INPIPE echo "$BRIDGE_PASS" >&3
echo "exit" > $INPIPE echo "exit" >&3
wait $bridge_pid wait $bridge_pid
} }
bridge-cli() { bridge-cli() {
mkfifo $INPIPE mkfifo $INPIPE
sleep infinity > $INPIPE &
$BRIDGE --cli < $INPIPE & $BRIDGE --cli < $INPIPE &
exec 3> $INPIPE
bridge_pid=$! bridge_pid=$!
} }
start() { start() {
bridge-cli bridge-cli
echo "info" > $INPIPE echo "info" >&3
wait $bridge_pid wait $bridge_pid
} }