Skip to content

fix: sysprocattr option - #157

Merged
Ullaakut merged 2 commits into
masterfrom
fix-sysprocattr
Jul 26, 2026
Merged

fix: sysprocattr option#157
Ullaakut merged 2 commits into
masterfrom
fix-sysprocattr

Conversation

@Ullaakut

Copy link
Copy Markdown
Owner

Goal of this PR

Fixes #155

Creates an empty struct before calling modifySysProcAttr.
Thanks to @roysmanfo for the bug report.

How did I test it

  • Added regression test
  • Linter still passes

@Ullaakut
Ullaakut requested a review from Copilot July 26, 2026 15:08
@Ullaakut Ullaakut self-assigned this Jul 26, 2026
@Ullaakut Ullaakut added the bug Something isn't working label Jul 26, 2026
@Ullaakut
Ullaakut merged commit 947892b into master Jul 26, 2026
1 of 2 checks passed
@Ullaakut
Ullaakut deleted the fix-sysprocattr branch July 26, 2026 15:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where Scanner’s WithCustomSysProcAttr callback could not modify the underlying exec.Cmd.SysProcAttr because it was nil by default. The change ensures the struct is initialized before invoking the user-provided modifier function, and adds a regression test to prevent regressions.

Changes:

  • Initialize cmd.SysProcAttr to &syscall.SysProcAttr{} before calling modifySysProcAttr.
  • Add a regression test asserting the callback receives (and can mutate) the same SysProcAttr pointer stored on the command.
  • Fix a minor typo in the Scanner type comment.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
nmap.go Fixes a typo in the Scanner doc comment.
helpers.go Ensures exec.Cmd.SysProcAttr is non-nil before invoking WithCustomSysProcAttr callback.
helpers_test.go Adds regression coverage validating initialization and pointer identity for SysProcAttr.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to modify the SysProcAttr for a scan

2 participants