Use async main in dotnet-watch
This commit is contained in:
parent
c5879dbed7
commit
76aa9b26fc
|
|
@ -3,6 +3,7 @@
|
|||
<Import Project="..\..\build\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<LangVersion>7.1</LangVersion>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<AssemblyName>dotnet-watch</AssemblyName>
|
||||
<OutputType>exe</OutputType>
|
||||
|
|
|
|||
|
|
@ -31,15 +31,21 @@ namespace Microsoft.DotNet.Watcher
|
|||
_reporter = CreateReporter(verbose: true, quiet: false, console: _console);
|
||||
}
|
||||
|
||||
public static int Main(string[] args)
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
DebugHelper.HandleDebugSwitch(ref args);
|
||||
using (var program = new Program(PhysicalConsole.Singleton, Directory.GetCurrentDirectory()))
|
||||
try
|
||||
{
|
||||
return program
|
||||
.RunAsync(args)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
DebugHelper.HandleDebugSwitch(ref args);
|
||||
using (var program = new Program(PhysicalConsole.Singleton, Directory.GetCurrentDirectory()))
|
||||
{
|
||||
return await program.RunAsync(args);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine("Unexpected error:");
|
||||
Console.Error.WriteLine(ex.ToString());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -200,7 +206,6 @@ namespace Microsoft.DotNet.Watcher
|
|||
private static IReporter CreateReporter(bool verbose, bool quiet, IConsole console)
|
||||
=> new PrefixConsoleReporter(console, verbose || CliContext.IsGlobalVerbose(), quiet);
|
||||
|
||||
|
||||
private string NormalizePath(string path)
|
||||
{
|
||||
if (path == null || Path.IsPathRooted(path))
|
||||
|
|
|
|||
Loading…
Reference in New Issue