Keep track of the child ii(1) process

This commit is contained in:
Pierre Pronchery 2020-02-03 05:00:47 +01:00
parent e4143a6c44
commit afa60c4f9d

View File

@ -45,7 +45,7 @@ _irc()
return 1 return 1
fi fi
ret=0 ret=0
pid= pid=0
server=$(echo "$1" | $TR A-Z a-z) server=$(echo "$1" | $TR A-Z a-z)
port="$2" port="$2"
nickname="$3" nickname="$3"
@ -56,9 +56,8 @@ _irc()
#connect to the server #connect to the server
if [ ! -w "$serverin" ]; then if [ ! -w "$serverin" ]; then
_info "$server: Connecting to server" _info "$server: Connecting to server"
#FIXME really keep track of pid
$II -s "$server" -p "$port" -n "$nickname" & $II -s "$server" -p "$port" -n "$nickname" &
pid=0 pid=$!
fi fi
#wait until the server is connected to #wait until the server is connected to
loop=0 loop=0
@ -119,7 +118,7 @@ _irc()
_error "$channel: Could not join channel" _error "$channel: Could not join channel"
fi fi
fi fi
if [ -n "$pid" ]; then if [ $pid -gt 0 ]; then
#quit the server #quit the server
_info "$server: Disconnecting from server" _info "$server: Disconnecting from server"
fortune=$($FORTUNE | $HEAD -n 1 | $CUT -c 1-50) fortune=$($FORTUNE | $HEAD -n 1 | $CUT -c 1-50)