jonsequitur / dotnet-repl

A polyglot REPL built on .NET Interactive
MIT License
713 stars 35 forks source link

Unable to redirect stdout #52

Closed stuartpa closed 2 years ago

stuartpa commented 2 years ago

I'd like to use dotnot-repl to validate notebooks in automation (CI/CD). When trying to redirect output, it errors:

C:\src>dotnet-repl --exit-after-run --notebook test.ipynb > out.txt Unhandled exception: System.NotSupportedException: Terminal does not support ANSI

Which prevents using dotnet-repl in any environment that captures stdout.

patriksvensson commented 2 years ago

I suspect this is because the AnsiConsole instance explicitly is created with Ansi = true instead of letting Spectre.Console detect ANSI support.

stuartpa commented 2 years ago

If someone produces me a build with the ability to control this via a command line switch I can test it.

I am not able to build the repo myself, currently, I'm getting:

Severity Code Description Project File Line Suppression State Error NETSDK1045 The current .NET SDK does not support targeting .NET 6.0. Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports .NET 6.0. dotnet-repl C:\Program Files\dotnet\sdk\5.0.409\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 141

patriksvensson commented 2 years ago

@stuartpa Try building this branch and see if it works: https://github.com/patriksvensson-forks/dotnet-repl/tree/feature/global-json

jonsequitur commented 2 years ago

I can reproduce this and work out a fix.