From 4537fd118da1be744ae8f1ee8c19294cf0eaf32c Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 25 Jun 2019 09:54:06 +0800 Subject: [PATCH] fix #1362 Call the asynchronous GetUsageInfo method correctly --- .../Volo/Abp/Cli/Commands/AddModuleCommand.cs | 2 +- .../Volo/Abp/Cli/Commands/AddPackageCommand.cs | 2 +- .../Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs | 4 ++-- .../src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs | 2 +- .../Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs | 3 ++- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs index 6f40dbc18f..8d406feab3 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs @@ -27,7 +27,7 @@ namespace Volo.Abp.Cli.Commands { if (commandLineArgs.Target == null) { - throw new CliUsageException("Module name is missing!" + Environment.NewLine + Environment.NewLine + GetUsageInfo()); + throw new CliUsageException("Module name is missing!" + Environment.NewLine + Environment.NewLine + await GetUsageInfo()); } var skipDbMigrations = Convert.ToBoolean( diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs index 24185d7c07..c7922cbc33 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs @@ -27,7 +27,7 @@ namespace Volo.Abp.Cli.Commands { if (commandLineArgs.Target == null) { - throw new CliUsageException("Package name is missing!" + Environment.NewLine + Environment.NewLine + GetUsageInfo()); + throw new CliUsageException("Package name is missing!" + Environment.NewLine + Environment.NewLine + await GetUsageInfo()); } await ProjectNugetPackageAdder.AddAsync( diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs index 52517b72fa..1828035fa1 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs @@ -26,14 +26,14 @@ namespace Volo.Abp.Cli.Commands { if (commandLineArgs.Target.IsNullOrEmpty()) { - throw new CliUsageException("Username name is missing!" + Environment.NewLine + Environment.NewLine + GetUsageInfo()); + throw new CliUsageException("Username name is missing!" + Environment.NewLine + Environment.NewLine + await GetUsageInfo()); } Console.Write("Password: "); var password = ConsoleHelper.ReadSecret(); if (password.IsNullOrWhiteSpace()) { - throw new CliUsageException("Password name is missing!" + Environment.NewLine + Environment.NewLine + GetUsageInfo()); + throw new CliUsageException("Password name is missing!" + Environment.NewLine + Environment.NewLine + await GetUsageInfo()); } await AuthService.LoginAsync(commandLineArgs.Target, password); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index 44b5416e1e..7ab05bf02c 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.Cli.Commands { if (commandLineArgs.Target == null) { - throw new CliUsageException("Project name is missing!" + Environment.NewLine + Environment.NewLine + GetUsageInfo()); + throw new CliUsageException("Project name is missing!" + Environment.NewLine + Environment.NewLine + await GetUsageInfo()); } Logger.LogInformation("Creating a new project..."); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs index dbd95ef1f7..a04111d5e4 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging.Abstractions; using Volo.Abp.Cli.Args; using Volo.Abp.Cli.ProjectModification; using Volo.Abp.DependencyInjection; +using Volo.Abp.Threading; namespace Volo.Abp.Cli.Commands { @@ -67,7 +68,7 @@ namespace Volo.Abp.Cli.Commands } throw new CliUsageException("No solution or project found in this directory." + Environment.NewLine + - Environment.NewLine + GetUsageInfo()); + Environment.NewLine + AsyncHelper.RunSync(GetUsageInfo)); } public Task GetUsageInfo()