From 6ac4aa50b395ca4694f70cb8def6bacb4479fdf9 Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Mon, 6 Dec 2021 15:45:35 -0400 Subject: [PATCH] fix: check if interactive when handling signals --- main.go | 5 ++--- shell.go | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index d537cf9..8330175 100644 --- a/main.go +++ b/main.go @@ -200,7 +200,6 @@ input: } } } - running = true HandleHistory(input) RunInput(input) @@ -266,12 +265,12 @@ func HandleSignals() { switch s { case os.Interrupt: hooks.Em.Emit("signals.sigint") - if !running { + if !running && interactive { lr.ClearInput() } case syscall.SIGWINCH: hooks.Em.Emit("signals.resize") - if !running { + if !running && interactive { lr.Resize() } } diff --git a/shell.go b/shell.go index 11f1f2f..cae6c23 100644 --- a/shell.go +++ b/shell.go @@ -15,6 +15,7 @@ import ( ) func RunInput(input string) { + running = true cmdArgs, cmdString := splitInput(input) // If alias was found, use command alias