mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2026-05-16 13:20:35 +00:00
e9734c1ff2
When TruffleHog times out in pre-receive hooks, it fails to output diagnostic logs. Changes: - Ensure log output is flushed before process termination in all exit paths: * Defer log sync in run() function for normal exits * Sync logs in signal handler before os.Exit(0) * Sync logs before os.Exit(183) when results are found * Sync logs in logFatalFunc before os.Exit() calls - Use exec.CommandContext instead of exec.Command for git log/diff to ensure processes are killed when context is cancelled - Add WaitDelay to git commands to provide grace period for cleanup This ensures diagnostic output is captured when git operations block in pre-receive hook environments and logs are visible when process is killed.