metropolis/node/core/metrics: build command inside runnable

It is not allowed to reuse exec.Command. The command has to be rebuild
every time the runnable restarts, because go does not allow command
restarts.

Change-Id: Ia0f7c8e598bbd0c275d0cb47c020099d1baa5865
Reviewed-on: https://review.monogon.dev/c/monogon/+/2368
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/node/core/metrics/metrics.go b/metropolis/node/core/metrics/metrics.go
index 4aa0872..ffae970 100644
--- a/metropolis/node/core/metrics/metrics.go
+++ b/metropolis/node/core/metrics/metrics.go
@@ -95,12 +95,13 @@
 
 	// Start all exporters as sub-runnables.
 	for _, exporter := range s.Exporters {
+		exporter := exporter
 		if exporter.Executable == "" {
 			continue
 		}
 
-		cmd := exec.CommandContext(ctx, exporter.Executable, exporter.Arguments...)
 		err := supervisor.Run(ctx, exporter.Name, func(ctx context.Context) error {
+			cmd := exec.CommandContext(ctx, exporter.Executable, exporter.Arguments...)
 			return supervisor.RunCommand(ctx, cmd)
 		})
 		if err != nil {