From 5cc153219b8bb6a2750c3ceefaad0fe80c5c9583 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Tue, 3 May 2022 19:52:22 +0200 Subject: [PATCH] Enable console color output --- dist/index.js | 5 +++++ src/installer.ts | 5 +++++ src/setup-dotnet.ts | 1 + 3 files changed, 11 insertions(+) diff --git a/dist/index.js b/dist/index.js index 1ef7203..f1b834f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -339,6 +339,10 @@ class DotnetCoreInstaller { } console.log(process.env['PATH']); } + static enableConsoleColorOutput() { + core.exportVariable('DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION', 'true'); + core.exportVariable('TERM', 'xterm'); + } // versionInfo - versionInfo of the SDK/Runtime resolveVersion(versionInfo) { return __awaiter(this, void 0, void 0, function* () { @@ -486,6 +490,7 @@ function run() { yield dotnetInstaller.installDotnet(); } installer.DotnetCoreInstaller.addToPath(); + installer.DotnetCoreInstaller.enableConsoleColorOutput(); } const sourceUrl = core.getInput('source-url'); const configFile = core.getInput('config-file'); diff --git a/src/installer.ts b/src/installer.ts index c25d23a..58ce319 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -197,6 +197,11 @@ export class DotnetCoreInstaller { console.log(process.env['PATH']); } + static enableConsoleColorOutput() { + core.exportVariable('DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION', 'true'); + core.exportVariable('TERM', 'xterm'); + } + // versionInfo - versionInfo of the SDK/Runtime async resolveVersion(versionInfo: DotNetVersionInfo): Promise { if (versionInfo.isExactVersion()) { diff --git a/src/setup-dotnet.ts b/src/setup-dotnet.ts index 64f3149..9487d93 100644 --- a/src/setup-dotnet.ts +++ b/src/setup-dotnet.ts @@ -50,6 +50,7 @@ export async function run() { await dotnetInstaller.installDotnet(); } installer.DotnetCoreInstaller.addToPath(); + installer.DotnetCoreInstaller.enableConsoleColorOutput(); } const sourceUrl: string = core.getInput('source-url');