From 65c0f8df1bc0c9e257f9045884019f2b7294320e Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Fri, 13 Dec 2024 10:47:45 -0600 Subject: [PATCH] quick fixes for cli tests --- main.go | 5 +++++ tests/cli-test.bash | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index f1ba41a..b599fc4 100644 --- a/main.go +++ b/main.go @@ -114,6 +114,10 @@ func main() { if !strings.HasSuffix(loadedConfig.Log.FileDir, "/") { loadedConfig.Log.FileDir += "/" } + if _, err := os.Stat(loadedConfig.Log.FileDir); os.IsNotExist(err) { + parentLogger.ErrorContext(parentCtx, "log directory does not exist", "directory", loadedConfig.Log.FileDir) + os.Exit(1) + } // logger, fileLocation, err = logging.UpdateLoggerToFile(logger, logFileDir, suffix) // if err != nil { // fmt.Printf("{\"time\":\"%s\",\"level\":\"ERROR\",\"msg\":\"%s\"}\n", time.Now().Format(time.RFC3339), err) @@ -503,6 +507,7 @@ func worker( if err != nil { pluginLogger.ErrorContext(updatedPluginCtx, "error running plugin", "error", err) pluginCancel() + workerCancel() // Send SIGQUIT to the main pid p, err := os.FindProcess(os.Getpid()) if err != nil { diff --git a/tests/cli-test.bash b/tests/cli-test.bash index 6e1616c..7876651 100755 --- a/tests/cli-test.bash +++ b/tests/cli-test.bash @@ -81,7 +81,7 @@ TESTS run_test cli-test-no-log-directory.yml <