From 2a8fe7738e9c4e65d7da9582d59bf13bcb17f666 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Mon, 2 Jan 2012 16:33:59 +0900 Subject: [PATCH] Giving a more helpful error message when not all I/O ports are available in the repl. --- main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.c b/main.c index cf8f6cbd..28ee8e3d 100644 --- a/main.c +++ b/main.c @@ -181,6 +181,10 @@ static void repl (sexp ctx, sexp env) { in = sexp_param_ref(ctx, env, sexp_global(ctx, SEXP_G_CUR_IN_SYMBOL)); out = sexp_param_ref(ctx, env, sexp_global(ctx, SEXP_G_CUR_OUT_SYMBOL)); err = sexp_param_ref(ctx, env, sexp_global(ctx, SEXP_G_CUR_ERR_SYMBOL)); + if (!(sexp_iportp(in) && sexp_oportp(out) && sexp_oportp(err))) { + fprintf(stderr, "No standing I/O ports found, aborting. Maybe a bad -x language?\n"); + exit_failure(); + } sexp_port_sourcep(in) = 1; while (1) { sexp_write_string(ctx, "> ", out);