fix: check if interactive when handling signals

dev
TorchedSammy 2021-12-06 15:45:35 -04:00
parent 2a71fb0075
commit 6ac4aa50b3
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
2 changed files with 3 additions and 3 deletions

View File

@ -200,7 +200,6 @@ input:
} }
} }
} }
running = true
HandleHistory(input) HandleHistory(input)
RunInput(input) RunInput(input)
@ -266,12 +265,12 @@ func HandleSignals() {
switch s { switch s {
case os.Interrupt: case os.Interrupt:
hooks.Em.Emit("signals.sigint") hooks.Em.Emit("signals.sigint")
if !running { if !running && interactive {
lr.ClearInput() lr.ClearInput()
} }
case syscall.SIGWINCH: case syscall.SIGWINCH:
hooks.Em.Emit("signals.resize") hooks.Em.Emit("signals.resize")
if !running { if !running && interactive {
lr.Resize() lr.Resize()
} }
} }

View File

@ -15,6 +15,7 @@ import (
) )
func RunInput(input string) { func RunInput(input string) {
running = true
cmdArgs, cmdString := splitInput(input) cmdArgs, cmdString := splitInput(input)
// If alias was found, use command alias // If alias was found, use command alias