-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
os: document that FindProcess is a no-op on Unix #14146
Comments
Your issue is unrelated to running os.FindProcess multiple times. Running it once suffices. And the underlying cause of your problem is that on Unix-systems, os.FindProcess isn't actually doing any finding. All it does is return an *os.Process with the pid set to the argument. As such, the error will always be nil. If you ran your code on Windows, it would return an error. |
@dominikh i don't have window. wondering why golang have limited this error code to only window. |
anyway its seems to be a issue because of giving wrong error information !!!! |
This is documented. Working as intended. |
@bradfitz Could you please provide me the link of that document. What do you mean by "working as intended" ??? imo before closing the issue you should have provided me the link of document. do you mean to say os.FindProcess giving correct error message in all system. ? If that problem have fixed then i want to know where, in which version it have fixed other wise there is no point of closing known issue bug. known issue bug should always open. |
Oh, it's only documented internally, not in the public docs. Okay, we can fix the docs. |
@bradfitz Thank you for opening the issue :) Now you have changed the subject line of this bug " Golang os.FindProcess is giving wrong error information to os: document that FindProcess is a no-op on Unix " I am using latest version of Golang and didn't saw that error message problem have solved. If error message problem had not solved yet then you should have raised separate documentation issue. Mixing of both documentation and code change issue really confusing. Any way closing of issue should only happen when you provide following things:
If it have not solved and if i get time then i might think about to solve this issue and send a patch. Thank you :) |
There is no code issue, only a documentation issue. os.FindProcess does not check the validity of a PID on most systems. That needs to be documented. Its behaviour won't change. |
@dominikh Thanks for clearing this. That make sense. Now i will follow some other method to check whether given pid process exist in unix system or not instead of using os.FindProcess. |
CL https://golang.org/cl/19093 mentions this issue. |
You can send it signal 0 to test it, assuming you have permission. |
@bradfitz |
Hi Team,
I just find one bug in golang.
bug is this when you execute os.FindProcess (pid) command two time then its giving wrong information. ie. if process is not exist then executing os.FindProcess for that process pid again is not giving proper error, its giving nil error.
for eg execute below code:
so expected behaviour of this code is it should not print anything. but its printing that pid is exist. even process is not running.
Any help regarding this. i am using this in one of the my application.
Thanks, in advance :)
The text was updated successfully, but these errors were encountered: