Enable console color output

This commit is contained in:
Vladimir Safonkin 2022-05-03 19:52:22 +02:00
parent c0d4ad69d8
commit 5cc153219b
3 changed files with 11 additions and 0 deletions

5
dist/index.js vendored
View File

@ -339,6 +339,10 @@ class DotnetCoreInstaller {
} }
console.log(process.env['PATH']); 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 // versionInfo - versionInfo of the SDK/Runtime
resolveVersion(versionInfo) { resolveVersion(versionInfo) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
@ -486,6 +490,7 @@ function run() {
yield dotnetInstaller.installDotnet(); yield dotnetInstaller.installDotnet();
} }
installer.DotnetCoreInstaller.addToPath(); installer.DotnetCoreInstaller.addToPath();
installer.DotnetCoreInstaller.enableConsoleColorOutput();
} }
const sourceUrl = core.getInput('source-url'); const sourceUrl = core.getInput('source-url');
const configFile = core.getInput('config-file'); const configFile = core.getInput('config-file');

View File

@ -197,6 +197,11 @@ export class DotnetCoreInstaller {
console.log(process.env['PATH']); 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 // versionInfo - versionInfo of the SDK/Runtime
async resolveVersion(versionInfo: DotNetVersionInfo): Promise<string> { async resolveVersion(versionInfo: DotNetVersionInfo): Promise<string> {
if (versionInfo.isExactVersion()) { if (versionInfo.isExactVersion()) {

View File

@ -50,6 +50,7 @@ export async function run() {
await dotnetInstaller.installDotnet(); await dotnetInstaller.installDotnet();
} }
installer.DotnetCoreInstaller.addToPath(); installer.DotnetCoreInstaller.addToPath();
installer.DotnetCoreInstaller.enableConsoleColorOutput();
} }
const sourceUrl: string = core.getInput('source-url'); const sourceUrl: string = core.getInput('source-url');