Closed chris-findlay closed 2 years ago
...for that matter, can .Net tell if it's connected to a TTY for output?
I know most .NET programs use Console.IsOutputRedirected
to check if they are in a terminal. When running a process with CliWrap, the output of that property will be true
. You can fake a terminal by wrapping it instead -- i.e. instead of Cli.Wrap("foo")
do Cli.Wrap("/bin/sh").WithArguments(...)
. In this case, the output of the underlying process (launched by sh
) will not be considered redirected.
Now that you mention it, that seems obvious - thanks heaps.
Details
Some commands (e.g.
ls
ordocker
) output differently based on the result of calling isatty(3), e.g. different formats or using cursor control escape codes to keep the output tidy.Is there any way to get a process run from .Net to get a true answer from that check so it thinks it's outputting to a terminal?
I really like the look of this lib, but if it can manage the above, then switching to it will be an easy sell. (c: