@@ -391,6 +391,8 @@ private bool StartCore(ProcessStartInfo startInfo)
391
391
startInfo . RedirectStandardOutput &&
392
392
startInfo . RedirectStandardError ) ;
393
393
394
+ string ? originalFilename = startInfo . FileName ;
395
+
394
396
if ( startInfo . UseShellExecute )
395
397
{
396
398
string verb = startInfo . Verb ;
@@ -411,7 +413,7 @@ private bool StartCore(ProcessStartInfo startInfo)
411
413
{
412
414
argv = ParseArgv ( startInfo ) ;
413
415
414
- isExecuting = ForkAndExecProcess ( filename , argv , envp , cwd ,
416
+ isExecuting = ForkAndExecProcess ( originalFilename , filename , argv , envp , cwd ,
415
417
startInfo . RedirectStandardInput , startInfo . RedirectStandardOutput , startInfo . RedirectStandardError ,
416
418
setCredentials , userId , groupId , groups ,
417
419
out stdinFd , out stdoutFd , out stderrFd , usesTerminal ,
@@ -424,7 +426,7 @@ private bool StartCore(ProcessStartInfo startInfo)
424
426
filename = GetPathToOpenFile ( ) ;
425
427
argv = ParseArgv ( startInfo , filename , ignoreArguments : true ) ;
426
428
427
- ForkAndExecProcess ( filename , argv , envp , cwd ,
429
+ ForkAndExecProcess ( originalFilename , filename , argv , envp , cwd ,
428
430
startInfo . RedirectStandardInput , startInfo . RedirectStandardOutput , startInfo . RedirectStandardError ,
429
431
setCredentials , userId , groupId , groups ,
430
432
out stdinFd , out stdoutFd , out stderrFd , usesTerminal ) ;
@@ -439,7 +441,7 @@ private bool StartCore(ProcessStartInfo startInfo)
439
441
throw new Win32Exception ( SR . DirectoryNotValidAsInput ) ;
440
442
}
441
443
442
- ForkAndExecProcess ( filename , argv , envp , cwd ,
444
+ ForkAndExecProcess ( originalFilename , filename , argv , envp , cwd ,
443
445
startInfo . RedirectStandardInput , startInfo . RedirectStandardOutput , startInfo . RedirectStandardError ,
444
446
setCredentials , userId , groupId , groups ,
445
447
out stdinFd , out stdoutFd , out stderrFd , usesTerminal ) ;
@@ -473,6 +475,7 @@ private bool StartCore(ProcessStartInfo startInfo)
473
475
}
474
476
475
477
private bool ForkAndExecProcess (
478
+ string originalFilename ,
476
479
string ? filename , string [ ] argv , string [ ] envp , string ? cwd ,
477
480
bool redirectStdin , bool redirectStdout , bool redirectStderr ,
478
481
bool setCredentials , uint userId , uint groupId , uint [ ] ? groups ,
@@ -481,7 +484,8 @@ private bool ForkAndExecProcess(
481
484
{
482
485
if ( string . IsNullOrEmpty ( filename ) )
483
486
{
484
- throw new Win32Exception ( Interop . Error . ENOENT . Info ( ) . RawErrno ) ;
487
+ int errno = Interop . Error . ENOENT . Info ( ) . RawErrno ;
488
+ throw CreateExceptionForFailedToStartFileDirectory ( GetErrorMessage ( errno ) , errno , originalFilename , cwd ) ;
485
489
}
486
490
487
491
// Lock to avoid races with OnSigChild
0 commit comments