Skip to content

Commit

Permalink
sigh double restart
Browse files Browse the repository at this point in the history
  • Loading branch information
abe-winter committed Jan 12, 2025
1 parent cdf3fc8 commit f68e150
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions subsystems/viamagent/viamagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (a *agentSubsystem) Update(ctx context.Context, cfg *pb.DeviceSubsystemConf

expectedPath := filepath.Join(agent.ViamDirs["bin"], subsysName)
if runtime.GOOS == "windows" {
// no systemd on windows -- check if binary is runnable, then restart service.
// no systemd on windows -- for now you need to double-restart.
if _, err := exec.Command(expectedPath, "--version").Output(); err != nil {

Check failure on line 76 in subsystems/viamagent/viamagent.go

View workflow job for this annotation

GitHub Actions / Test lint and build

G204: Subprocess launched with variable (gosec)
return false, errw.Wrap(err, "testing binary")
}
Expand All @@ -81,10 +81,10 @@ func (a *agentSubsystem) Update(ctx context.Context, cfg *pb.DeviceSubsystemConf
// if _, err := exec.Command("powershell", "-command", "Restart-Service viam-agent").Output(); err != nil {
// return false, errw.Wrap(err, "restarting windows service")
// }
if agent.GlobalCancel == nil {
return false, errors.New("can't call globalCancel because it's nil")
}
agent.GlobalCancel()
// if agent.GlobalCancel == nil {
// return false, errors.New("can't call globalCancel because it's nil")
// }
// agent.GlobalCancel()
return true, nil
}

Expand Down

0 comments on commit f68e150

Please sign in to comment.