Skip to content

Commit

Permalink
Trim decoded exit code
Browse files Browse the repository at this point in the history
If the decoded payload has a trailing newline for whatever reason,
parseInt will fail.
  • Loading branch information
slice committed May 26, 2020
1 parent 38d745c commit e6ce295
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/scala/snailgun/protocol/Protocol.scala
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class Protocol(
case ChunkTypes.Exit.toByteRepr =>
val bytes = readPayload(bytesToRead, in)
val code =
Integer.parseInt(new String(bytes, StandardCharsets.US_ASCII))
Integer.parseInt(new String(bytes, StandardCharsets.US_ASCII).trim)
Action.Exit(code)
case _ =>
val error = new RuntimeException(s"Unexpected chunk type: $chunkType")
Expand Down

0 comments on commit e6ce295

Please sign in to comment.