summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Norton2017-04-25 12:18:23 +0100
committerRobert Norton2017-04-25 16:32:18 +0100
commitcaf4a8f85c5b4a217f72d51dbad4dd95c0801881 (patch)
tree18ec31e73534c1cec9cc6a54bbc55b0791738aa6
parent2f61214f174f8f2aee598431c130223750a0e9a9 (diff)
Don't die if stdin gets closed (e.g. when running unit tests).
-rw-r--r--mips/run_embed.ml5
1 files changed, 3 insertions, 2 deletions
diff --git a/mips/run_embed.ml b/mips/run_embed.ml
index d217aff7..7d83355e 100644
--- a/mips/run_embed.ml
+++ b/mips/run_embed.ml
@@ -125,8 +125,9 @@ let rec debug_print_caps capregs start stop =
let handle_uart uart_written uart_wdata uart_rdata uart_rvalid =
let (pending, _, _) = (Unix.select [Unix.stdin] [] [] 0.0) in
if pending != [] then
- input_buf := (!input_buf) @ [(input_byte stdin)];
-
+ try
+ input_buf := (!input_buf) @ [(input_byte stdin)]
+ with End_of_file -> ();
if (read_bit_reg uart_written) then
begin