Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start-Process fails on argument-less invocation of 7zip #11578

Closed
Rareitor opened this issue Jan 14, 2020 · 5 comments
Closed

Start-Process fails on argument-less invocation of 7zip #11578

Rareitor opened this issue Jan 14, 2020 · 5 comments
Labels
Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a Resolution-No Activity Issue has had no activity for 6 months or more WG-Cmdlets-Management cmdlets in the Microsoft.PowerShell.Management module

Comments

@Rareitor
Copy link

For likely any version of Powershell beyond 5.1 (6.0.0 and up), if Start-Process is used to execute 7z.exe with the Wait and NoNewWindow flags enabled, the process throws an exception after apparently actually running the executable.

Steps to reproduce

$7zipExec = <path-to-7zip-exec>
Start-Process -FilePath $7zipExec -NoNewWindow -Wait

Expected behavior

Prints usage reference like:
Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...] [@listfile]
...

Actual behavior

Prints usage reference as it should, but also ends with:
Start-Process : Cannot process request because the process (###) has exited.
At line:1 char:1
+ Start-Process -FilePath $7zipExec -NoNewWindow -Wait;
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

Environment data

Tested with Powershell:
- 4.0 (Windows Server 2012R2)
- 5.1 (Windows 10 1809)
- 6.0.0 (Windows 10 1809)
- 6.2.3 (Windows 10 1809)
- 7.0.0 RC1 (Windows 10 1809)
@Rareitor Rareitor added the Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a label Jan 14, 2020
@iSazonov iSazonov added the WG-Cmdlets-Management cmdlets in the Microsoft.PowerShell.Management module label Jan 14, 2020
@mklement0
Copy link
Contributor

I just tried with 7-Zip 18.05 on Windows PowerShell, PowerShell 7.0.5, 7.1.2, and the latest preview, 7.2.0-preview.4, and I don't see the symptom - but my Windows 10 version is newer: Version 20H2, OS Build: 19042.867

Are you still on the same Windows 10 version and do you still see the symptom?

As an aside: there's generally no good reason to use Start-Process for synchronous invocation of a console application in the same window: direct invocation does that automatically (in your case: & $7zipExec), and has the added advantage of integrating with PowerShell's output streams - see MicrosoftDocs/PowerShell-Docs#6239

Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

2 similar comments
Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

@microsoft-github-policy-service microsoft-github-policy-service bot added Resolution-No Activity Issue has had no activity for 6 months or more labels Nov 16, 2023
Copy link
Contributor

This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a Resolution-No Activity Issue has had no activity for 6 months or more WG-Cmdlets-Management cmdlets in the Microsoft.PowerShell.Management module
Projects
None yet
Development

No branches or pull requests

3 participants