-
-
Notifications
You must be signed in to change notification settings - Fork 275
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
CliWrap only outputs foreign characters in Mac Catalyst app #261
Comments
Does anything change if you explicitly set output encoding to UTF8? |
Thanks for the quick response @Tyrrrz. Changing the encoding to UTF8 with I thought checking what Using Looking at the source, appears that the default is EDIT: Leaving this here as well incase others come across it in search. Using the non-buffered output var stdOutBuffer = new StringBuilder();
var stdErrBuffer = new StringBuilder();
var result2 = await Cli.Wrap("date")
.WithStandardOutputPipe(PipeTarget.ToStringBuilder(stdOutBuffer))
.WithStandardErrorPipe(PipeTarget.ToStringBuilder(stdErrBuffer))
.ExecuteAsync();
var stdOut = stdOutBuffer.ToString();
var stdErr = stdErrBuffer.ToString();
Debug.WriteLine("## (non-buffered) StandardOutput ##");
Debug.WriteLine(stdOut);
Debug.WriteLine("## (non-buffered) StandardError ##");
Debug.WriteLine(stdErr); will also produce the error,
But using encoding in the pipe target (eg. I am unsure if this is something that is considered broken, or something that can be fixed, or something that should be mentioned in the readme. But the solution is very simple, and hopefully if anyone else searches for it they also find this. I couldn't see any way to change it at the Mac Catalyst level. Happy to have this issue closed if you are happy to have it closed. |
This is interesting, as it appears that the default encoding is resolved incorrectly. If Update: it looks like |
I tried to dig through dotnet runtime repo and xamarin-macios repo to see if I could find info as to why Mac Catalyst is doing what it was doing. If you don't mind sharing, what did you find out about |
I've looked at the source code for the https://source.dot.net/#System.Diagnostics.Process/System/Diagnostics/Process.Unix.cs,462 Actually, |
Ah, thanks! At least I was in the right repo looking for it, just looking for the wrong things. |
Version
v3.6.6
Platform
.NET 8, macOS 15.0.1, M3 MacBook Pro
Steps to reproduce
dotnet new maccatalyst --name MyApp
)Details
Reproduction of the issue is in my CliWrapMacCatalystTestApp repo. This is a new app, but the main bits to see are,
The app that brought me here was an AvaloniaUI app I am porting to .NET MAUI. I first thought this was a MAUI issue as it did not happen previously. But then I replicated it in a Mac Catalyst standalone app. I then thought it was a .NET macOS issue, but then I could not replicate it in a MacOS App (non-MacCatalyst .NET mac app). Then I found that in Mac Catalyst I could use
System.Diagnostics.Process
fine. So I now assume it is an issue with this library (or the library is not usingSystem.Diagnostics.Process
under the hood).Additionally CliWrap does not have this issue in a .NET console app on the same machine. It seems specific to only Mac Catalyst apps, even if I disable the sandbox.
From the sample above, the expected output is the current date.
The actual output is the result data is foreign characters. I assume some sort of encoding issue.
I am not able to test on an Intel based mac at this time.
Checklist
The text was updated successfully, but these errors were encountered: