Skip to content

Add automatic variable for current process path#26991

Open
kilasuit wants to merge 2 commits intoPowerShell:masterfrom
kilasuit:copilot/add-automatic-variable-current-process-path
Open

Add automatic variable for current process path#26991
kilasuit wants to merge 2 commits intoPowerShell:masterfrom
kilasuit:copilot/add-automatic-variable-current-process-path

Conversation

@kilasuit
Copy link
Collaborator

@kilasuit kilasuit commented Mar 11, 2026

PR Summary

Add's Automatic Vairiable for Current Process Path $PSProcessPath
fixes #26950

PR Context

Removes need to use .NET method for this mimicing current $PID automatic variable

PR Checklist

Copilot AI and others added 2 commits March 11, 2026 01:03
…path

Co-authored-by: kilasuit <6355225+kilasuit@users.noreply.github.com>
@kilasuit kilasuit requested a review from a team as a code owner March 11, 2026 01:09
Copilot AI review requested due to automatic review settings March 11, 2026 01:09
Copy link
Contributor

Copilot AI left a comment

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 introduces a new fixed/automatic variable ($pp) intended to expose the full path of the current process executable (using Environment.ProcessPath) and adds coverage to validate its behavior.

Changes:

  • Add $pp to the engine’s fixed variables initialization and to the AllScope variable type map.
  • Add a localized description string for the new variable.
  • Add Pester tests validating $pp value/immutability.

Reviewed changes

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

File Description
test/powershell/Language/Parser/AutomaticVariables.Tests.ps1 Adds Pester coverage for $pp behavior (type, const-ness, value).
src/System.Management.Automation/resources/RunspaceInit.resx Adds description text for $pp (shown via variable metadata).
src/System.Management.Automation/engine/SpecialVariables.cs Registers pp as a known AllScope variable/type.
src/System.Management.Automation/engine/SessionState.cs Initializes $pp as a Constant/AllScope fixed variable using Environment.ProcessPath.

@kilasuit kilasuit force-pushed the copilot/add-automatic-variable-current-process-path branch from 9f8194f to a7ad113 Compare March 11, 2026 02:22
@kilasuit kilasuit marked this pull request as draft March 11, 2026 02:27
@kilasuit kilasuit marked this pull request as ready for review March 11, 2026 02:27
@kilasuit kilasuit requested a review from Copilot March 11, 2026 02:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

@kilasuit kilasuit added WG-Engine core PowerShell engine, interpreter, and runtime CL-Engine Indicates that a PR should be marked as an engine change in the Change Log WG-NeedsReview Needs a review by the labeled Working Group labels Mar 11, 2026
@microsoft-github-policy-service microsoft-github-policy-service bot added the Review - Needed The PR is being reviewed label Mar 20, 2026
@microsoft-github-policy-service
Copy link
Contributor

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

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

Labels

CL-Engine Indicates that a PR should be marked as an engine change in the Change Log Review - Needed The PR is being reviewed WG-Engine core PowerShell engine, interpreter, and runtime WG-NeedsReview Needs a review by the labeled Working Group

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a Current Process Path Automatic Variable

3 participants