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
echo "login" > $INPIPE
echo "$BRIDGE_USER" > $INPIPE
echo "$BRIDGE_PASS" > $INPIPE
echo "exit" > $INPIPE
echo "login" >&3
echo "$BRIDGE_USER" >&3
echo "$BRIDGE_PASS" >&3
echo "exit" >&3
wait $bridge_pid
}
bridge-cli() {
mkfifo $INPIPE
sleep infinity > $INPIPE &
$BRIDGE --cli < $INPIPE &
exec 3> $INPIPE
bridge_pid=$!
}
start() {
bridge-cli
echo "info" > $INPIPE
echo "info" >&3
wait $bridge_pid
}