From 4a1388a5c784a6d3c7d2655dd96e27bf604297e6 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sat, 9 Feb 2019 00:55:11 +0300 Subject: [PATCH] read configuration after initialization --- app.go | 16 +++++++++++----- client.go | 6 ------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app.go b/app.go index 257bdf4..14dd75f 100644 --- a/app.go +++ b/app.go @@ -136,6 +136,12 @@ func (app *app) loop() { clientChan := app.ui.readExpr() serverChan := readExpr() + for _, path := range gConfigPaths { + if _, err := os.Stat(path); !os.IsNotExist(err) { + app.readFile(path) + } + } + if gCommand != "" { p := newParser(strings.NewReader(gCommand)) @@ -340,12 +346,12 @@ func (app *app) runShell(s string, args []string, prefix string) { switch prefix { case "%": - go func() { - app.cmd = cmd - app.cmdOutBuf = nil - app.ui.msg = "" - app.ui.cmdPrefix = ">" + app.cmd = cmd + app.cmdOutBuf = nil + app.ui.msg = "" + app.ui.cmdPrefix = ">" + go func() { reader := bufio.NewReader(out) for { b, err := reader.ReadByte() diff --git a/client.go b/client.go index 28c9489..0686b7d 100644 --- a/client.go +++ b/client.go @@ -33,12 +33,6 @@ func run() { app := newApp() - for _, path := range gConfigPaths { - if _, err := os.Stat(path); !os.IsNotExist(err) { - app.readFile(path) - } - } - if err := app.nav.readMarks(); err != nil { app.ui.printf("reading marks file: %s", err) }