commit ace403bc0adf326375feb2ac4bad00048911fc88 parent 4a9ab08ecf65e9447ee7f44545ab35c61a96c0f8 Author: hhvn <hayden@haydenvh.com> Date: Mon, 1 Mar 2021 01:14:02 +0000 bot: implement fifo-based input, as tail -f wouldn't recognize when a connexion was broken Signed-off-by: mys <> Diffstat:
M | bot | | | 15 | +++++++++------ |
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/bot b/bot @@ -2,14 +2,17 @@ source botenv -echo "NICK $nick" > $input -echo "USER $nick * * :$nick" >> $input - while true do - tail -f $input | $connect_command | while read res + rm $input + mkfifo $input + + ( + echo "NICK $nick" + echo "USER $nick * * :$nick" + ) | cat - $input | $connect_command | tr -d '\r' | while read res do echo "$(date "+[%y:%m:%d %T]")$res" >> $log - ./botreply "$(echo "$res" | tr -d '\r')" >> $input - done + ./botreply "$res" + done > $input done