Browse Source
Set `Environment.ExitCode` if there is a `CliUsaeException` or external error.
Resovle #20090
pull/20092/head
maliming
2 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
2 changed files with
7 additions and
4 deletions
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs
|
|
@ -83,6 +83,7 @@ public class CliService : ITransientDependency |
|
|
catch (CliUsageException usageException) |
|
|
catch (CliUsageException usageException) |
|
|
{ |
|
|
{ |
|
|
Logger.LogWarning(usageException.Message); |
|
|
Logger.LogWarning(usageException.Message); |
|
|
|
|
|
Environment.ExitCode = 1; |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
|
|
|
|
@ -74,6 +74,7 @@ public class CmdHelper : ICmdHelper, ITransientDependency |
|
|
process?.WaitForExit(); |
|
|
process?.WaitForExit(); |
|
|
|
|
|
|
|
|
exitCode = process.ExitCode; |
|
|
exitCode = process.ExitCode; |
|
|
|
|
|
Environment.ExitCode = exitCode; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -144,6 +145,7 @@ public class CmdHelper : ICmdHelper, ITransientDependency |
|
|
process.WaitForExit(); |
|
|
process.WaitForExit(); |
|
|
|
|
|
|
|
|
exitCode = process.ExitCode; |
|
|
exitCode = process.ExitCode; |
|
|
|
|
|
Environment.ExitCode = exitCode; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return output.Trim(); |
|
|
return output.Trim(); |
|
|
|