Unix system executables terminate with error if transcription enabled
See original GitHub issueSteps to reproduce
Enable transcription (Start-Transcript
)
Run any executable system command.
Expected behavior
Command executes and terminates cleanly.
Actual behavior
Command executes fine, but upon termination an error is always printed: Program 'foo' failed to run: The method or operation is not implemented.At line:1 char:1
Examples:
PS /> uname
Darwin
Program 'uname' failed to run: The method or operation is not implemented.At line:1 char:1
+ uname
+ ~~~~~.
At line:1 char:1
+ uname
+ ~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
PS /> curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
Program 'curl' failed to run: The method or operation is not implemented.At line:1 char:1
+ curl google.com
+ ~~~~~~~~~~~~~~~.
At line:1 char:1
+ curl google.com
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
Does not happen if I capture the program’s output into a variable:
PS /> $x = uname
PS /> $x
Darwin
Stack:
PS /> $error[0].Exception.ToString()
System.Management.Automation.ApplicationFailedException: Program 'curl' failed to run: The method or operation is not implemented.At line:1 char:1
+ curl google.com
+ ~~~~~~~~~~~~~~~. ---> System.NotImplementedException: The method or operation is not implemented.
at Microsoft.PowerShell.ConsoleHostRawUserInterface.GetBufferContents(Rectangle rectangle)
at System.Management.Automation.Internal.Host.InternalHostRawUserInterface.GetBufferContents(Rectangle r)
at System.Management.Automation.NativeCommandProcessor.Complete()
--- End of inner exception stack trace ---
at System.Management.Automation.NativeCommandProcessor.Complete()
at System.Management.Automation.CommandProcessorBase.DoComplete()
at System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase commandRequestingUpstreamCommandsToStop)
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Environment data
OSX Yosemite 14.5.0
> $PSVersionTable
PSVersion 6.0.0-alpha
PSEdition Core
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 3.0.0.0
GitCommitId v6.0.0-alpha.9
CLRVersion
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Exit the script if any statement fails
1 Answer 1 ... You can still use set -e . If you have specific statement which you expect to fail, you simply...
Read more >Exit out of the Script Command inside a Script
I'm new to Linux. I have a bash script that invokes an executable. I'd like use the SCRIPT command inside the script and...
Read more >Automatic exit from Bash shell script on error [duplicate]
Use the set -e builtin: #!/bin/bash set -e # Any subsequent(*) commands which fail will cause the shell script to exit immediately.
Read more >How to Exit When Errors Occur in Bash Scripts
A short guide to exiting when errors occur in your bash scripts. ... exit $exit_code fi } # enable !! command completion set...
Read more >Linux and Unix exit code tutorial with examples
Tutorial on using exit codes from Linux or UNIX commands. Examples of how to get the exit code of a command, how to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Open source FTW! Problem is due to the fact that I am transcribing. Native apps will always fail like this on Unix if you have transcription enabled. After disabling transcription, things work as expected.
The error stack points to the not-implemented (on
UNIX
) method: https://github.com/PowerShell/PowerShell/blob/c1faf1e6e10fc1ce45e84ef6f49ae7136c67a111/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs#L1738-L1741Following that back, this codepath gets invoked when you run a native application standalone, with transcription enabled: https://github.com/PowerShell/PowerShell/blob/c1faf1e6e10fc1ce45e84ef6f49ae7136c67a111/src/System.Management.Automation/engine/NativeCommandProcessor.cs#L586
I found the issue, working on a fix.