From 9ebee461e42a571810b5a1c84f0fde42ce3db2b8 Mon Sep 17 00:00:00 2001 From: Vladimir Kravets Date: Sun, 2 Dec 2018 13:00:28 +0200 Subject: [PATCH] Using shell from config if specified Don't execute extra command if it's not needed --- main.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index ab850fe..4d793e8 100644 --- a/main.go +++ b/main.go @@ -31,13 +31,13 @@ func main() { logger.Fatalf("Failed to allocate pty: %s", err) } - shellStr, err := loginshell.Shell() - if err != nil { - logger.Fatalf("Failed to ascertain your shell: %s", err) - } - - if conf.Shell != "" { - shellStr = conf.Shell + shellStr := conf.Shell + if shellStr == "" { + loginShell, err := loginshell.Shell() + if err != nil { + logger.Fatalf("Failed to ascertain your shell: %s", err) + } + shellStr = loginShell } os.Setenv("TERM", "xterm-256color") // controversial! easier than installing terminfo everywhere, but obviously going to be slightly different to xterm functionality, so we'll see...