Skip to content

Conversation

@iclanton
Copy link
Member

@iclanton iclanton commented Jan 4, 2026

Summary

Introduce a commandLine property to IProcessInfo that gets populated with the CLI that was passed into the process. In Node 24, the process name is set to "MainThread", so this restores some previous functionality from before Node 24.

How it was tested

Introduced unit tests.

Impacted documentation

None.

@github-project-automation github-project-automation bot moved this to Needs triage in Bug Triage Jan 4, 2026
@iclanton iclanton moved this from Needs triage to In Progress in Bug Triage Jan 7, 2026
/**
* The full command line of the process, when available.
*
* @remarks On some platforms this may be empty or truncated for kernel processes
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a bit more specificity on which platforms would be good.

if (line.includes('\t')) {
// Tab-delimited output (PowerShell path with CommandLine)
const win32Match: RegExpMatchArray | null = line.match(
/^\s*(?<ppid>\d+)\s+(?<pid>\d+)\s+(?<name>[^\s]+)(?:\s+(?<cmd>.+))?\s*$/
Copy link
Member

Choose a reason for hiding this comment

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

Feels like this should be a const along with the other regex, and use the same capture group consts as well.

Copy link
Member

Choose a reason for hiding this comment

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

Also, doesn't this regex do the same as the const regex above? They seem to contain the same content.

processId = parseInt(win32Match.groups.pid, 10);
parentProcessId = parseInt(win32Match.groups.ppid, 10);
} else {
// Legacy space-delimited listing: treat everything after pid as name, no command line
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean that process names can have spaces? Is that why tab-delimited was done later? Also, the regex used for the tab-delimited output seems to not actually care about tabs specifically, just whitespace, which seems to mean that the above regex should also work identically here (or that the above regex has an issue and would push the other segments of the space-containing process name into the command group)

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

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants