Moved the reporter to shared code
This commit is contained in:
parent
086207ebcc
commit
063eb45f8b
4 changed files with 14 additions and 14 deletions
|
@ -130,7 +130,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
|
||||
#if DEBUG
|
||||
var sw = Stopwatch.StartNew();
|
||||
Console.WriteLine($"> {_process.StartInfo.FileName} {_process.StartInfo.Arguments}");
|
||||
Reporter.Output.WriteLine($"> {_process.StartInfo.FileName} {_process.StartInfo.Arguments}".Green().Bold());
|
||||
#endif
|
||||
_process.Start();
|
||||
_process.BeginOutputReadLine();
|
||||
|
@ -139,7 +139,15 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
var exitCode = await _processTcs.Task;
|
||||
|
||||
#if DEBUG
|
||||
Console.WriteLine($"> {_process.StartInfo.FileName} {_process.StartInfo.Arguments} exited with {exitCode} in {sw.ElapsedMilliseconds} ms.");
|
||||
var message = $"> {_process.StartInfo.FileName} {_process.StartInfo.Arguments} exited with {exitCode} in {sw.ElapsedMilliseconds} ms.";
|
||||
if (exitCode == 0)
|
||||
{
|
||||
Reporter.Output.WriteLine(message.Green().Bold());
|
||||
}
|
||||
else
|
||||
{
|
||||
Reporter.Output.WriteLine(message.Red().Bold());
|
||||
}
|
||||
#endif
|
||||
|
||||
return new CommandResult(
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
"Microsoft.DotNet.Cli.Utils": {
|
||||
"type": "build",
|
||||
"version": "1.0.0-*"
|
||||
},
|
||||
"Microsoft.Extensions.CommandLineUtils.Sources": {
|
||||
"type": "build",
|
||||
"version": "1.0.0-*"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Dnx.Runtime.Common.CommandLine;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
{
|
||||
// Stupid-simple console manager
|
||||
internal static class Reporter
|
||||
{
|
||||
public static AnsiConsole Output { get; } = AnsiConsole.GetOutput(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
|
||||
public static AnsiConsole Error { get; } = AnsiConsole.GetError(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue