PowerShell
PowerShell copied to clipboard
Feature Request: improve "cannot run a document" message
Summary of the new feature/enhancement
I had to go look at the source code to understand what "cannot run a document" actually meant. Please consider rewording this. Perhaps - "cannot run a non-executable".
Note that are two messages with this wording - CantActivateDocumentInPipeline
and CantActivateDocumentInPowerShellCore
.
https://github.com/PowerShell/PowerShell/blob/c909541b7797b60462188a4abe9592a8763c1fbb/src/System.Management.Automation/engine/NativeCommandProcessor.cs#L1133-L1146
/cc @sdwheeler @joeyaiello
@aelij Please add links to source code to help reviewers.
@iSazonov Added
@aelij Thanks! Could you please add links to CantActivateDocumentInPipeline
and CantActivateDocumentInPowerShellCore
resource string too?
PowerShell/src/System.Management.Automation/resources/ParserStrings.resx
Line 592:
<data name="CantActivateDocumentInPipeline" xml:space="preserve">
<value>Cannot run a document in the middle of a pipeline: {0}.</value>
</data>
Suggested text: "Cannot invoke a document in the middle of a pipeline: {0}"
Line 1356:
<data name="CantActivateDocumentInPowerShellCore" xml:space="preserve">
<value>Cannot run a document in PowerShell: {0}.</value>
</data>
Suggested text: "This platform does not support file handlers for document invocation: {0}"
@sdwheeler I find word "document" a bit confusing (and somewhat Windows-y :). Shells have files and executables. Even the PS error when it can't find a command doesn't use this word:
The term 'foo' is not recognized as a name of a cmdlet, function, script file, or executable program.
I defer to the product team for better wording. But, as I understand it, document invocation is a Windows specific feature and that is what this error is about.
It's basically using ProcessStartInfo.UseShellExecute
which is supported on multiple platforms.
Can this be bumped? I had no idea what this meant and I'm fluent in both Linux and Windows. If the team would like to stand by the "document" word, please append a helpful message that lets us know we have to make it executable.
This is a beautiful and helpful error message.
Line |
3 | Install-Package Microsoft.PowerShell.SDK -RequiredVersion 7.2.7 -Skip …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Sudo rights are required to install packages in
| '/usr/local/share/PackageManagement/NuGet/Packages'. Try again
| by launching powershell with sudo, or install in
| '/home/runner/.local/share/PackageManagement/NuGet/Packages'
| by adding "-Scope CurrentUser" to your command.
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.
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.
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.
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.