-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: throws error if dir not found #3419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: throws error if dir not found #3419
Conversation
This reverts commit 1fcff0a.
// Check if the directory exists | ||
if _, err := os.Stat(gitDir); os.IsNotExist(err) { | ||
return fmt.Errorf("directory does not exist: %s", gitDir) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this change is the only one that's needed. With just it applied, this is the output I get:
trufflehog (remotes/origin/HEAD *) % ./trufflehog git file:///oops
🐷🔑🐷 TruffleHog. Unearth your secrets. 🐷🔑🐷
2024-10-16T16:14:08-04:00 info-0 trufflehog running source {"source_manager_worker_id": "hN9fy", "with_units": true}
2024-10-16T16:14:08-04:00 error trufflehog error running scan {"error": "engine failed to finish execution: fatal: directory does not exist: /oops"}
trufflehog (remotes/origin/HEAD *) % echo $?
1
Are you seeing something different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rosecodym Thanks for the review, I have removed the code. Can you please check again?
Signed-off-by: Sahil Silare <[email protected]>
Signed-off-by: Sahil Silare <[email protected]>
Signed-off-by: Sahil Silare <[email protected]>
@kashifkhan0771 Can you please review this minor PR? Thanks! |
Description:
This PR relates to #3005 . If the directory is not found, the process returns an error message and exits.
Checklist:
make test-community
)?make lint
this requires golangci-lint)?