Fixed bug when script prints content right before exiting

This commit is contained in:
Daniil Gentili 2016-04-15 19:25:43 +02:00
parent decd11ee0a
commit 495c23def4

View File

@ -148,16 +148,16 @@ forward() {
} }
startproc() { startproc() {
rm -r $copname (rm -r $copname
tmux kill-session -t $copname)2>/dev/null
mkfifo $copname mkfifo $copname
tmux kill-session -t $copname TMUX= tmux new-session -d -s $copname "./question &>$copname; sleep 10; rm -r $copname"
TMUX= tmux new-session -d -s $copname "./question &>$copname" while [ -p "$copname" ];do
while tmux ls | grep -q $copname;do
read -t 10 line read -t 10 line
[ "$line" != "" ] && send_message "${USER[ID]}" "$line" [ "$line" != "" ] && send_message "${USER[ID]}" "$line"
line= line=
done <$copname done <$copname
rm -r $copname
} }
inproc() { inproc() {
@ -225,7 +225,7 @@ Available commands:
/info: Get shorter info message about this bot. /info: Get shorter info message about this bot.
/question: Start interactive chat. /question: Start interactive chat.
/cancel: Cancel any currently running interactive chats. /cancel: Cancel any currently running interactive chats.
Written by @topkecleon, Juan Potato (@awkward_potato), Lorenzo Santina (BigNerd95) and Daniil Gentili (danog) Written by @topkecleon, Juan Potato (@awkward_potato), Lorenzo Santina (BigNerd95) and Daniil Gentili (@danogentili)
Contribute to the project: https://github.com/topkecleon/telegram-bot-bash Contribute to the project: https://github.com/topkecleon/telegram-bot-bash
" "
;; ;;