fix: Misc cleanup fixes

This commit is contained in:
Abhisek Datta
2026-01-08 16:35:22 +05:30
parent eaeaff9cb8
commit cb081348fa
2 changed files with 4 additions and 7 deletions
+2 -5
View File
@@ -221,18 +221,15 @@ func (g *packageManagerGuard) continueExecution(ctx context.Context, pc *package
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
// Apply sandbox if enabled
pmName := g.packageManager.Name()
result, err := executor.ApplySandbox(ctx, cmd, pmName)
if err != nil {
return fmt.Errorf("failed to apply sandbox: %w", err)
}
defer result.Close() // Clean up sandbox resources
// Only run the command if the sandbox didn't already execute it
defer result.Close()
if result.ShouldRun() {
// We will fail based on executed command's exit code. This is important
// because other tools (scripts, CI etc.) may depend on this exit code.
return cmd.Run()
}
+2 -2
View File
@@ -242,13 +242,13 @@ func (f *proxyFlow) executeWithProxy(ctx context.Context, parsedCmd *packagemana
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
// Apply sandbox if enabled (sandbox preserves proxy environment variables already set on cmd.Env)
pmName := f.pm.Name()
result, err := executor.ApplySandbox(ctx, cmd, pmName)
if err != nil {
return fmt.Errorf("failed to apply sandbox: %w", err)
}
defer result.Close() // Clean up sandbox resources
defer result.Close()
log.Debugf("Executing command: %s %v", parsedCmd.Command.Exe, parsedCmd.Command.Args)
log.Debugf("Proxy environment: HTTP_PROXY=%s, HTTPS_PROXY=%s, NODE_EXTRA_CA_CERTS=%s", proxyURL, proxyURL, caCertPath)