mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
fix: Misc cleanup fixes
This commit is contained in:
+2
-5
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user