Is there a way to write this shorter and better readable ?
‘\u{3}’,"\u0003", ctrl-c - can this be written in the same style on sender and receiver side ?
channel.send(char.not_nil!.to_s) - is it shorter possible ?
channel = Channel(String).new
spawn do #handle stdin input char by char - do until ctrl-c pressed
while (char = STDIN.raw &.read_char) != '\u{3}' #ctrl-c
channel.send(char.not_nil!.to_s)
end
channel.send('\u{3}'.to_s)
end
loop do #do until cttrl-c
r = channel.receive
if r == "\u0003" #handle ctrl-c from channel
break
end