Tyrrrz / CliWrap

Library for running command-line processes
MIT License
4.32k stars 264 forks source link

Possibility to adjust ProcessStartInfo #189

Closed bernd5 closed 1 year ago

bernd5 commented 1 year ago

Details

Some applications like dotnet query the "standard output encoding" before writing to std out.

Without changing the console encoding - unsupported charaters are replaced with "?". Reading that e.g. with Utf8 Encoding does not help.

To change the console code page a custom encoding can be used via ProcessStartInfo. Therefore it would be great if CreateStartInfo() could become protected virtual. Another alternative would be an ExecuteAsync overload with an ProcessStartInfo adjustment delegate like:

public delegate void AdjustStartInfo(ref ProcessStartInfo info);

On windows there is a "Change code page utility (chcp)". So a command could be changed to "cmd /c chcp 65001 >NUL && REAL_COMMAND". But this is quite ugly.

bernd5 commented 1 year ago

See: https://github.com/Tyrrrz/CliWrap/issues/63