@@ -222,7 +222,7 @@ protected virtual ProcessStartInfo PrepareNodeProcessStartInfo(
222
222
}
223
223
else
224
224
{
225
- debuggingArgs = string . Empty ;
225
+ debuggingArgs = string . Empty ;
226
226
}
227
227
228
228
var thisProcessPid = Process . GetCurrentProcess ( ) . Id ;
@@ -325,17 +325,26 @@ private static void SetEnvironmentVariable(ProcessStartInfo startInfo, string na
325
325
326
326
private static Process LaunchNodeProcess ( ProcessStartInfo startInfo )
327
327
{
328
- var process = Process . Start ( startInfo ) ;
329
-
330
- // On Mac at least, a killed child process is left open as a zombie until the parent
331
- // captures its exit code. We don't need the exit code for this process, and don't want
332
- // to use process.WaitForExit() explicitly (we'd have to block the thread until it really
333
- // has exited), but we don't want to leave zombies lying around either. It's sufficient
334
- // to use process.EnableRaisingEvents so that .NET will grab the exit code and let the
335
- // zombie be cleaned away without having to block our thread.
336
- process . EnableRaisingEvents = true ;
337
-
338
- return process ;
328
+ try {
329
+ var process = Process . Start ( startInfo ) ;
330
+
331
+ // On Mac at least, a killed child process is left open as a zombie until the parent
332
+ // captures its exit code. We don't need the exit code for this process, and don't want
333
+ // to use process.WaitForExit() explicitly (we'd have to block the thread until it really
334
+ // has exited), but we don't want to leave zombies lying around either. It's sufficient
335
+ // to use process.EnableRaisingEvents so that .NET will grab the exit code and let the
336
+ // zombie be cleaned away without having to block our thread.
337
+ process . EnableRaisingEvents = true ;
338
+
339
+ return process ;
340
+ } catch ( Exception ex ) {
341
+ var message = "Failed to start Node process. To resolve this:.\n \n "
342
+ + "[1] Ensure that Node.js is installed and can be found in one of the PATH directories.\n "
343
+ + $ " Current PATH enviroment variable is: { Environment . GetEnvironmentVariable ( "PATH" ) } \n "
344
+ + " Make sure the Node executable is in one of those directories, or update your PATH.\n \n "
345
+ + "[2] See the InnerException for further details of the cause." ;
346
+ throw new InvalidOperationException ( message , ex ) ;
347
+ }
339
348
}
340
349
341
350
private static string UnencodeNewlines ( string str )
0 commit comments