Skip to content
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: skip return when reading from channel #32

Merged
merged 1 commit into from
Aug 8, 2024
Merged

fix: skip return when reading from channel #32

merged 1 commit into from
Aug 8, 2024

Conversation

alegrey91
Copy link
Owner

Fix #31

@alegrey91 alegrey91 requested a review from 89luca89 August 8, 2024 05:47
cmd/capture.go Outdated Show resolved Hide resolved
cmd/hunt.go Outdated Show resolved Hide resolved
Signed-off-by: Alessio Greggi <ale_grey_91@hotmail.it>
@alegrey91 alegrey91 merged commit 02cd5fd into main Aug 8, 2024
@@ -49,7 +49,7 @@ by passing the function name symbol and the binary args.
for _, functionSymbol := range functionSymbolList {
syscalls, err := captor.Capture(functionSymbol, args, captureOpts)
if err != nil {
return fmt.Errorf("error capturing syscall: %w", err)
fmt.Printf("error capturing syscall: %w", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no %w with Printf if I'm not wrong

Suggested change
fmt.Printf("error capturing syscall: %w", err)
fmt.Printf("error capturing syscall: %v", err)

https://pkg.go.dev/fmt#hdr-Printing

@@ -49,7 +49,7 @@ by passing the function name symbol and the binary args.
for _, functionSymbol := range functionSymbolList {
syscalls, err := captor.Capture(functionSymbol, args, captureOpts)
if err != nil {
return fmt.Errorf("error capturing syscall: %w", err)
fmt.Printf("error capturing syscall: %w", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could consider using

Either errors.Join to gather them all

Or fmt.Fprintf to send the errors to stderr

Suggested change
fmt.Printf("error capturing syscall: %w", err)
fmt.Fprintf(os.Stderr, "error capturing syscall: %v", err)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] hunt command returns at first reading error
3 participants