New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore the executable file be deleted in Process Start #40748
Ignore the executable file be deleted in Process Start #40748
Conversation
ce7cea6
to
370d459
Compare
Tagging subscribers to this area: @eiriktsarpalis |
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.OSX.cs
Outdated
Show resolved
Hide resolved
Hi @lindexi I am not sure if I understand the problem that you are trying to solve. Could you please provide a sample repro and full explanation of what you are trying to achieve and how this PR helps you? Thank, |
@adamsitnik This is the problem: dotnet-campus/dotnetCampus.UpdateAllDotNetTools#4 |
I think this fix is ok workaround. It may be better to add a direct way to get current process executable path to System.Native. Going through libproc to find the current process executable path is unnecessary compilation. Also, we ought to have a public API that returns the current process executable path. I have opened API proposal at: #40862 |
Thanks! |
} | ||
catch (Win32Exception) | ||
{ | ||
// It will throw System.ComponentModel.Win32Exception (2): No such file or Directory when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it filter for NativeErrorCode == 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danmosemsft Thank you. I agree with you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this as a temporary workaround until we get the proper API that returns the executable path in place. I do not think it is that important to make this condition perfect, and it is likely that the proc_pidpath
has other failure modes e.g. permission errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good
In MAC System when using Process.Start method to start a excetuable file it can still delete this file and the Interop.libproc.proc_pidpath method still execute and return a win32 exception