Skip to content

Commit 8433e97

Browse files
author
Paul van Brenk
committed
PR Feedback
1 parent c56d5a6 commit 8433e97

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

Nodejs/Product/PressAnyKey/PressAnyKey.cs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,30 @@ private static int Main(string[] args)
3333
proc.WaitForExit();
3434
exitCode = proc.ExitCode;
3535
}
36-
catch (Win32Exception exc)
36+
catch (Win32Exception)
3737
{
38-
Console.WriteLine($"Failed to start process: '{exc.Message}'.");
39-
Console.WriteLine("Probable cause is the Nodejs exe is corrupt, please re-install.");
38+
Console.WriteLine("Failed to start process.");
39+
Console.WriteLine("Probable cause is the Node.js exe is corrupt, please re-install.");
40+
Console.WriteLine($"path: '{args[2]}'.");
4041
exitCode = -1;
4142
}
4243

43-
if (args[0] == "both" ||
44-
(exitCode == 0 && args[0] == "normal") ||
45-
(exitCode != 0 && args[0] == "abnormal"))
44+
var shouldWait = true;
45+
46+
switch (args[0])
47+
{
48+
case "both":
49+
shouldWait = true;
50+
break;
51+
case "normal":
52+
shouldWait = exitCode == 0;
53+
break;
54+
case "abnormal":
55+
shouldWait = exitCode != 0;
56+
break;
57+
}
58+
59+
if (shouldWait)
4660
{
4761
Console.Write("Press any key to continue...");
4862
Console.ReadKey();

0 commit comments

Comments
 (0)