@@ -53,6 +53,7 @@ func runCommand(args []string) error {
5353}
5454
5555func runDetached (pidFile , configFile string , cfg * config.Config ) error {
56+ //nolint:gosec // the arguments are provided by the user
5657 cmd := exec .Command (os .Args [0 ], "run" , "-config" , configFile )
5758 cmd .Env = os .Environ ()
5859 cmd .SysProcAttr = & syscall.SysProcAttr {
@@ -62,6 +63,7 @@ func runDetached(pidFile, configFile string, cfg *config.Config) error {
6263 cmd .Stdin = nil
6364 stdoutFile , stdoutErr := getInternalStdoutFile ()
6465 if stdoutErr != nil {
66+ //nolint:sloglint //currently working on adding support for custom logger
6567 slog .Warn ("Failed to create log file for meeseeks, using /dev/null" , "error" , stdoutErr .Error ())
6668 cmd .Stdout = nil
6769 cmd .Stderr = nil
@@ -77,6 +79,7 @@ func runDetached(pidFile, configFile string, cfg *config.Config) error {
7779 return fmt .Errorf ("failed to write PID file: %w" , err )
7880 }
7981
82+ //nolint:sloglint //currently working on adding support for custom logger
8083 slog .Info ("Started meeseeks (detached)" , "pid" , cmd .Process .Pid , "program_count" , len (cfg .Programs ))
8184
8285 _ = cmd .Process .Release ()
@@ -96,18 +99,20 @@ func runForeground(cfg *config.Config, sockPath, pidFile string) error {
9699 go func () {
97100 slog .Info ("Started meeseeks" , "program_count" , len (cfg .Programs ))
98101
99- if err := s .Wait (ctx ); err != nil {
100- slog .Warn ("Wait completed with error" , "error" , err )
102+ if waitErr := s .Wait (ctx ); waitErr != nil {
103+ slog .Warn ("Wait completed with error" , "error" , waitErr )
101104 }
102105 }()
103106
104107 sigChan := make (chan os.Signal , 1 )
105108 signal .Notify (sigChan , syscall .SIGINT , syscall .SIGTERM )
106109
107110 <- sigChan
111+ //nolint:sloglint //currently working on adding support for custom logger
108112 slog .Info ("Received signal, shutting down..." )
109113 err = s .Stop ()
110114 if err != nil {
115+ //nolint:sloglint //currently working on adding support for custom logger
111116 slog .Warn ("Error stopping the server." , "error" , err .Error ())
112117 }
113118 _ = os .Remove (pidFile )
0 commit comments