Navigation Menu

Skip to content
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

Merged
merged 2 commits into from Aug 15, 2020

Conversation

lindexi
Copy link
Contributor

@lindexi lindexi commented Aug 13, 2020

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

@lindexi
Copy link
Contributor Author

lindexi commented Aug 13, 2020

@ghost
Copy link

ghost commented Aug 13, 2020

Tagging subscribers to this area: @eiriktsarpalis
See info in area-owners.md if you want to be subscribed.

@adamsitnik
Copy link
Member

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,
Adam

@adamsitnik adamsitnik added this to the Future milestone Aug 14, 2020
@adamsitnik adamsitnik added the untriaged New issue has not been triaged by the area owner label Aug 14, 2020
@lindexi
Copy link
Contributor Author

lindexi commented Aug 14, 2020

@jkotas
Copy link
Member

jkotas commented Aug 14, 2020

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

@jkotas jkotas merged commit 8907340 into dotnet:master Aug 15, 2020
@jkotas
Copy link
Member

jkotas commented Aug 15, 2020

Thanks!

}
catch (Win32Exception)
{
// It will throw System.ComponentModel.Win32Exception (2): No such file or Directory when
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good

@lindexi lindexi deleted the t/lindexi/ProcessGetExePath branch August 15, 2020 04:48
@adamsitnik adamsitnik modified the milestones: Future, 5.0.0 Aug 17, 2020
@adamsitnik adamsitnik removed the untriaged New issue has not been triaged by the area owner label Aug 17, 2020
@dotnet dotnet locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants