Skip to content

Commit

Permalink
fix: appease the linting gods
Browse files Browse the repository at this point in the history
  • Loading branch information
tulilirockz committed Dec 20, 2024
1 parent f592125 commit 319c307
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func Update(cmd *cobra.Command, args []string) {
distroboxUpdater.Config.Enabled = err == nil
distroboxUpdater.SetUsers(users)

mainSystemDriver, mainSystemDriverConfig, _, err := system.InitializeSystemDriver(*initConfiguration)
mainSystemDriver, mainSystemDriverConfig, _, _ := system.InitializeSystemDriver(*initConfiguration)

enableUpd, err := mainSystemDriver.Check()
if err != nil {
Expand Down
11 changes: 8 additions & 3 deletions pkg/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package session

import (
"bufio"
"context"
"fmt"
"io"
"log/slog"
Expand All @@ -26,13 +27,17 @@ func RunLog(logger *slog.Logger, level slog.Level, command *exec.Cmd) ([]byte, e
stderr, _ := command.StderrPipe()
multiReader := io.MultiReader(stdout, stderr)

command.Start()
if err := command.Wait(); err != nil {
logger.Warn("Error occoured starting external command", slog.Any("error", err))
}
scanner := bufio.NewScanner(multiReader)
scanner.Split(bufio.ScanLines)
for scanner.Scan() {
logger.With(slog.Bool("subcommand", true)).Log(nil, level, scanner.Text())
logger.With(slog.Bool("subcommand", true)).Log(context.TODO(), level, scanner.Text())
}
if err := command.Wait(); err != nil {
logger.Warn("Error occoured while waiting for external command", slog.Any("error", err))
}
command.Wait()

return scanner.Bytes(), scanner.Err()
}
Expand Down

0 comments on commit 319c307

Please sign in to comment.