diff --git a/crystal/src/fromipc.cr b/crystal/src/fromipc.cr index e2d9447..e411eec 100644 --- a/crystal/src/fromipc.cr +++ b/crystal/src/fromipc.cr @@ -1,4 +1,7 @@ # Read an IPC network packet and remove the first 4 bytes. buffer = Bytes.new 1_000_000 -len = STDIN.read buffer -STDOUT.write buffer[4.. len -1] +while true + len = STDIN.read buffer + break if len == 0 + STDOUT.write buffer[4.. len -1] +end diff --git a/crystal/src/input2ipc.cr b/crystal/src/input2ipc.cr index 80f9455..cbd4fb8 100644 --- a/crystal/src/input2ipc.cr +++ b/crystal/src/input2ipc.cr @@ -2,6 +2,7 @@ buffer = Bytes.new 1_000_000 while true len = STDIN.read buffer + break if len == 0 STDOUT.write_bytes len, IO::ByteFormat::BigEndian STDOUT.write buffer[0.. len -1] end