-
Notifications
You must be signed in to change notification settings - Fork 18.1k
proposal: os/exec: add an API to exec over the current process #18148
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
Comments
exec
a new program over the current process
x/sys/unix sounds preferable. |
If we can find a way to implement it portably, then depending on what we do, we should consider simply doing that in But perhaps it would be enough to simply retry |
(FWIW I tried to use syscall.Exec recently and found it pretty confusing as someone who has previously typed |
It's not possible to do portably, right? The concept doesn't exist in Windows, and it's not allowed in multithreaded (= all Go) programs on macOS. That's why there's only syscall.Exec. It seems like if syscall.Exec has bugs, they should be fixed (like #18146, which Ian is fixing). But it's in syscall precisely because it's not portable. |
It sounds like we should decline this proposal. Objections? |
I'm ok with declining. |
Uh oh!
There was an error while loading. Please reload this page.
Go programs cannot currently call
syscall.Exec
safely (see #18146).However, it is sometimes useful for a Go program to be able to execute some other command without retaining resources (such as memory) for a Go program that has no further work to do.
syscall.Exec
, although error-prone in Go, is the usual way to do that on a Unix-like platform.If we can find a way to implement portable
Exec
-like functionality compatible with the Go runtime, it would be nice to have an API for that as part of the standard library (perhaps in theos/exec
package). If it cannot be done portably, perhaps we could add something tox/sys/unix
?The text was updated successfully, but these errors were encountered: