Change the return value to a non-zero in case of failure (#3525)
authorJongHeonChoi <j-h.choi@samsung.com>
Tue, 29 Nov 2022 04:11:07 +0000 (13:11 +0900)
committerGitHub <noreply@github.com>
Tue, 29 Nov 2022 04:11:07 +0000 (04:11 +0000)
src/Tools/dotnet-dump/Dumper.cs

index 95716fe1cedeb31a557e17f3b312201ee0af4d8d..5b34ff856d97d87f099e2327a34503ffa9fbc6c3 100644 (file)
@@ -42,24 +42,24 @@ namespace Microsoft.Diagnostics.Tools.Dump
                 if (processId != 0)
                 {
                     Console.WriteLine("Can only specify either --name or --process-id option.");
-                    return 0;
+                    return -1;
                 }
                 processId = CommandUtils.FindProcessIdWithName(name);
                 if (processId < 0)
                 {
-                    return 0;
+                    return -1;
                 }
             }
 
             if (processId == 0) {
                 Console.Error.WriteLine("ProcessId is required.");
-                return 1;
+                return -1;
             }
 
             if (processId < 0)
             {
                 Console.Error.WriteLine($"The PID cannot be negative: {processId}");
-                return 1;
+                return -1;
             }
 
             try
@@ -98,7 +98,7 @@ namespace Microsoft.Diagnostics.Tools.Dump
                     if (crashreport)
                     {
                         Console.WriteLine("Crash reports not supported on Windows.");
-                        return 0;
+                        return -1;
                     }
 
                     Windows.CollectDump(processId, output, type);
@@ -150,7 +150,7 @@ namespace Microsoft.Diagnostics.Tools.Dump
                  ex is DiagnosticsClientException)
             {
                 console.Error.WriteLine($"{ex.Message}");
-                return 1;
+                return -1;
             }
 
             console.Out.WriteLine($"Complete");