Commit Graph
87 Commits
Author SHA1 Message Date
Dongbo Wang 78e437c6f3 Fix the PSNativeCommandArgumentPassing test (#27057) 2026-03-18 15:32:15 -07:00
Dongbo Wang 943257b247 Make some experimental features stable (#26348)
The following experimental features are made stable:
- PSNativeWindowsTildeExpansion
- PSRedirectToVariable
- PSSubsystemPluginModel
2025-10-30 14:26:03 -07:00
Dongbo Wang d68c15e743 Update PATH environment variable for package manager executable on Windows (#25847)
Implementation for PowerShell/PowerShell-RFC#391. A few implementation decisions:

1. Check the package manager list only once per process (**same as CMD**). So, changing the package manager list in registry doesn't affect a PowerShell session that is already running.

2. When detecting user/system PATH value changes, only check new items PREPENDED or APPENDED to the original string (**same as CMD**). The detection is made simple, which is not intended to detect complex changes to the user/system PATH.

3. The PATH update feature is disabled when the `Environment` provider is not available, or when the current session is restricted.
    - Both `Environment` provider and `IsSessionRestricted` are checked only once per PowerShell session.
    - Use `ConditionalWeakTable` to cache whether the feature is enabled or not for a given session.
    - We cannot use `thread-static` variable for the caching because it's possible for Runspace to reuse threads.
2025-08-20 12:53:59 -07:00
Patrick Meinecke 4faf52726d Make sure both stdout and stderr can be redirected from a native executable (#20997) 2024-03-14 11:42:30 -07:00
Dom Slee c56a52b8c0 Add tilde expansion for windows native executables (#20402) 2024-02-12 09:58:27 -08:00
James Truher [MSFT] 046301b716 Additional test hardening for tests which fail in release pass. (#20093) 2023-08-16 11:28:59 -07:00
James Truher [MSFT] 5437f387cc Add a new experimental feature to control native argument passing style on Windows (#18706) 2023-06-19 16:31:56 -07:00
James Truher [MSFT] b9b5136f0e Avoid checking screen scraping on non-Windows platforms before launching native app (#19812) 2023-06-19 11:26:14 -07:00
Aditya Patwardhan e95f7fb50f Test fixes for stabilizing tests (#19068) 2023-03-13 15:40:27 -07:00
Travis PlunkandAditya Patwardhan b2c4888ebb Add Windows ARM64 CI (#19040)
* Add CI for win-arm64

* Add common function to test for windows arm64

* Update because string where items need investigation

---------

Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>
2023-01-31 12:06:29 -08:00
James Truher [MSFT] 074aad6ea9 Add missing -Tag 'CI' to describe blocks. (#18316) 2022-10-17 15:27:24 -07:00
Steve Lee 6744ffb826 Make experimental feature PSNativeCommandArgumentPassing stable (#18044) 2022-09-12 09:48:09 -07:00
Steve Lee 9213b77659 Allow commands to still be executed even if the current working directory no longer exists (#17579) 2022-08-01 21:43:54 -07:00
James Truher [MSFT] 031fa93b4c Add find.exe to legacy argument binding behavior for Windows (#17715) 2022-07-20 14:47:50 -07:00
James Truher [MSFT] bfb59f1acf Do not always collapse space between parameter and value for native arguments. (#17708) 2022-07-18 17:51:51 -07:00
Steve Lee b7c875b0f2 Remove PSNativePSPathResolution experimental feature (#17670) 2022-07-18 17:25:46 -07:00
James Truher [MSFT] 1a24540e31 Enable more tests to be run in a container. (#17294) 2022-05-11 12:30:22 -07:00
Steve Lee 0f21156dee Fix $PSNativeCommandArgPassing = Windows to handle empty args correctly (#16639) 2022-01-11 23:21:32 -08:00
Dongbo Wang 723a50832d Don't throw exception when trying to resolve a possible link path (#16310) 2021-10-30 08:54:23 -07:00
Steve Lee cced56d75a Make PS-Committee reviewed experimental features stable (#15864) 2021-08-09 14:01:57 -07:00
James Truher [MSFT] ac762c1cce Add a Windows mode for native commands that allows some commands to use legacy argument passing (#15408) 2021-07-20 23:10:04 +00:00
Steve Lee 1df4236e6c Kill native processes in pipeline when pipeline is disposed on Unix (#15287) 2021-04-26 15:10:35 -07:00
James Truher [MSFT]andIlya a520e2c982 Native invocation using ArgumentList (#14692)
Co-authored-by: Ilya <darpa@yandex.ru>
2021-04-01 14:54:10 -07:00
Steve Lee 16cc9aaaf8 Fix blocking wait when starting file associated with a Windows application (#13750)
* Fix blocking wait when starting file associated with a Windows application in elevated process

* refactor check if app is WindowsApp
2020-10-07 12:58:24 +05:00
Steve Lee fc8ca61b3d Revert "Change PSNativePSPathResolution to not be Experimental" (#13734)
* Revert "Change `PSNativePSPathResolution` to not be Experimental (#13522)"

This reverts commit 74c743d279.
2020-10-03 21:20:24 +05:00
Steve Lee 74c743d279 Change PSNativePSPathResolution to not be Experimental (#13522) 2020-08-27 12:08:52 +05:00
Steve Lee d67649c300 Fix $? to not be $false when native command writes to stderr (#13395) 2020-08-19 09:31:38 -07:00
Steve Lee 511858a267 Make $ErrorActionPreference not affect stderr output of native commands (#13361) 2020-08-07 14:19:17 -07:00
xtqqczze f4382202ae Use correct casing for cmdlet name and cmdlet parameter name in *.ps1 files (#12584) 2020-05-07 17:00:30 +05:00
Steve Lee 23b1dd46ae Support passing PSPath to native commands (#12386) 2020-04-27 14:14:57 -07:00
Steve Lee b7cb335f03 Update copyright notice to latest guidance (#12190) 2020-03-24 11:08:37 -07:00
xtqqczze 920b671fb4 Unify pester test syntax for the arguments of -BeOfType (#11558) 2020-01-24 11:00:37 -08:00
xtqqczze e0d2e2aade Correct case of $PSHOME special variable 2020-01-13 19:35:33 +00:00
xtqqczze d0f28128f5 Correct case of $ExecutionContext special variable 2020-01-13 19:33:14 +00:00
xtqqczze 89e33f5772 Correct case of $Matches special variable 2020-01-13 19:15:17 +00:00
xtqqczze 743983390e Update pester syntax to v4 (#11544)
* Capitalize 'Should' command and fix whitespace

```powershell
$_ -ireplace '\s?\|\s?should\b',' | Should'
```

* Capitalise and apply hyphen to 'Not' parameter

```powershell
$_ -ireplace '(\| Should) not\b','$1 -Not'
```

* Capitalise and apply hyphen to 'Be' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?) -?be\b','$1 -Be'
```

* Capitalise and apply hyphen to 'BeExactly' parameter

$_ -ireplace '(\| Should(?: -Not)?) -?beexactly\b','$1 -BeExactly'

* Capitalise and apply hyphen to 'BeGreaterThan' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?) -?begreaterthan\b','$1 -BeGreaterThan'
```

* Use 'BeTrue' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?) -Be\s\$?true\b','$1 -BeTrue'
```

* Use 'BeFalse' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?) -Be\s\$?false\b','$1 -BeFalse'
```

* Capitalise and apply hyphen to 'Match' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?match\b','$1 -Match'
```

* Capitalise and apply hyphen to 'Throw' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?throw\b','$1 -Throw'
```

* Capitalise and apply hyphen to 'BeNullOrEmpty' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?benullorempty\b','$1 -BeNullOrEmpty'
```

* Capitalise 'Because' parameter

```powershell
$_ -ireplace '\s-because\b',' -Because'
```

* Fix 'BeNullOrEmpty'
2020-01-11 20:41:59 +05:00
Ilya b221c2afa2 Correct pwsh run (#11486) 2020-01-05 12:17:41 +05:00
Steve Lee 13f8ba284f Set the output encoding to [Console]::OutputEncoding for native commands (#10824) 2019-10-19 10:09:44 +05:00
xtqqczze a702f68974 Ensure Wait-UntilTrue returns $true in Pester tests (#9458) 2019-05-01 17:03:43 -07:00
Travis Plunk 5913c88aaf Mark tests in macOS CI which use applescript as pending/inconclusive (#9352)
Mark tests in macOS CI which use applescript as pending/inconclusive
2019-04-12 18:12:29 -07:00
xtqqczze 70de294fea Remove use of cmdlet aliases from .\test\powershell (#8546) 2018-12-28 13:48:23 +05:00
Bruce Payette 0c11582e6c Make Native globbing on UNIX return an absolute path when it is given an absolute path (#7106)
Fix #7089. Native globbing on UNIX was turning absolute paths into relative paths when it shouldn't. The code suppresses generating a relative path for paths starting with '~'. It also need to do the same for paths starting with '/'.
2018-08-07 14:38:22 -07:00
Klaudia Algiz 2df9aac811 Convert ShouldBeErrorId to Should -Throw -ErrorId in PowerShell tests (#6682)
Convert ShouldBeErrorId to Should -Throw -ErrorId in PowerShell tests.
Get rid of try { } catch { } formula to assert that errors were thrown.
Small fixes in tests to obey the new Pester -Parameter syntax.
2018-05-17 14:42:04 -07:00
Klaudia Algiz ceef2e37e9 Use new Pester syntax: -Parameter for Pester tests in Language. (#6304) 2018-03-21 10:47:08 -07:00
Steve Lee c1c5344a88 Update copyright and license headers (#6134)
Based on standard practices, we need to have a copyright and license notice at the top of each source file. Removed existing copyrights and updated/added copyright notices for .h, .cpp, .cs, .ps1, and .psm1 files.

Updated module manifests for consistency to have Author = "PowerShell" and Company = "Microsoft Corporation". Removed multiple line breaks.

Separate PR coming to update contribution document for new source files: #6140

Manually reviewed each change.

Fix #6073
2018-02-13 09:23:53 -08:00
James Truher [MSFT] fe3e44f305 Change $OutputEncoding to be utf8 without BOM rather than ASCII (#5369) 2017-11-07 14:49:14 -08:00
Jason Shirk 8391b9e155 Rework passing array literal to native commands (#5301) 2017-11-06 17:05:26 -08:00
Jason Shirk 6cbcf5dd3e Glob native command args only when not quoted
Also fix some minor issues with exceptions being raised when resolving
the path - falling back to no glob.

Fix: #3931 #4971
2017-10-31 23:34:50 -07:00
Steve Lee a384c6ea11 Change to not insert line breaks to output (except for tables) (#5193) 2017-10-30 09:54:44 -07:00
Steve Lee d85b9a472c Put command discovery before scripts for Unix (#5116)
* put command discovery before scripts for Unix

* remove unnecessary test
2017-10-23 17:54:28 -07:00