From 4dd024cb0b0729e33b08998e4b782b79ab824498 Mon Sep 17 00:00:00 2001 From: Russ Tokuyama Date: Wed, 24 May 2023 16:21:36 -1000 Subject: [PATCH] Fix for issue #497 Scheme client --- doc/conjure-client-scheme-stdio.txt | 3 +++ fnl/conjure/client/scheme/stdio.fnl | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/doc/conjure-client-scheme-stdio.txt b/doc/conjure-client-scheme-stdio.txt index bba6d5fc..471f03f8 100644 --- a/doc/conjure-client-scheme-stdio.txt +++ b/doc/conjure-client-scheme-stdio.txt @@ -37,6 +37,9 @@ options relevant to these mappings. cS Stop any existing Scheme REPL. +ei Interrupt running command. Same as pressing Ctrl-C + in a cmdline REPL. + ============================================================================== CONFIGURATION *conjure-client-scheme-stdio-configuration* diff --git a/fnl/conjure/client/scheme/stdio.fnl b/fnl/conjure/client/scheme/stdio.fnl index dfe9fbf4..65e9a4de 100644 --- a/fnl/conjure/client/scheme/stdio.fnl +++ b/fnl/conjure/client/scheme/stdio.fnl @@ -15,7 +15,8 @@ {:scheme {:stdio {:mapping {:start "cs" - :stop "cS"} + :stop "cS" + :interrupt "ei"} :command "mit-scheme" ;; Match "]=> " or "error> " :prompt_pattern "[%]e][=r]r?o?r?> " @@ -119,6 +120,12 @@ (fn [msg] (log.append (format-msg msg)))})))) +(defn interrupt [] + (with-repl-or-warn + (fn [repl] + (log.append ["; Sending interrupt signal."] {:break? true}) + (repl.send-signal 2)))) + (defn on-load [] (start)) @@ -131,7 +138,13 @@ (mapping.buf :SchemeStop (cfg [:mapping :stop]) stop - {:desc "Stop the REPL"})) + {:desc "Stop the REPL"}) + + (mapping.buf + :SchemeInterrupt (cfg [:mapping :interrupt]) + interrupt + {:desc "Interrupt the REPL"})) (defn on-exit [] (stop)) +