Skip to content

Fix powershell to update the PATH environment variable only if PATH exists#5021

Merged
daxian-dbw merged 1 commit intoPowerShell:masterfrom
SteveL-MSFT:crash-nopath
Oct 5, 2017
Merged

Fix powershell to update the PATH environment variable only if PATH exists#5021
daxian-dbw merged 1 commit intoPowerShell:masterfrom
SteveL-MSFT:crash-nopath

Conversation

@SteveL-MSFT
Copy link
Copy Markdown
Member

Linux service calling powershell may not have PATH set
only use PATH if it's not null
also fixed a test case using -TestCases without unique test name

Fix #5019

fixed code that expected PATH env var to exist
also fixed a test case using -TestCases without unique test name
Copy link
Copy Markdown

@anmenaga anmenaga left a comment

Choose a reason for hiding this comment

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

LGTM

@daxian-dbw daxian-dbw merged commit ba7dfcc into PowerShell:master Oct 5, 2017
@daxian-dbw daxian-dbw changed the title fix powershell host crash when PATH is not set Fix powershell to update the PATH environment variable only if PATH exists Oct 5, 2017
@SteveL-MSFT SteveL-MSFT deleted the crash-nopath branch October 16, 2017 21:53
@chipzoller
Copy link
Copy Markdown

There still seems to be an issue with this after being rolled into beta 9. For example, if PATH is not set, a test script fails when calling $myvar = hostname on Linux.

"hostname : The term 'hostname' is not recognized as the name of a cmdlet, funct
ion, script file, or operable program."

If PATH is set, the script executes correctly.

@SteveL-MSFT
Copy link
Copy Markdown
Member Author

PATH needs to be set for PowerShell to find exe's not in $PSHOME or current working directory, try setting $myvar to full path to hostname

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.

Failure when being run with no PATH variable

4 participants