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

syscall.Exec on Windows #30662

Closed
directionless opened this issue Mar 7, 2019 · 2 comments
Closed

syscall.Exec on Windows #30662

directionless opened this issue Mar 7, 2019 · 2 comments

Comments

@directionless
Copy link

What version of Go are you using (go version)?

$ go version
go1.12

Does this issue reproduce with the latest release?

Yes

What did you do?

I used syscall.Exec on a windows machine.

What did you expect to see?

I expected an exec to happen. Windows does seem to support some set of the exec calls.

What did you see instead?

syscall.Exec: not supported by windows
Due to https://golang.org/src/syscall/exec_windows.go#338

Discussion

I'm not sure what all the context for this is, but is there a reason Exec isn't supported on windows?

@ianlancetaylor
Copy link
Contributor

As far as I know the _exec function on Windows just starts a new process and exits the current one. You can do that anyhow in Go, using the os/exec package. syscall.Exec on Unix systems starts a new executable in the same process, with the same process ID. I don't think Windows has that facility, so we don't provide syscall.Exec on Windows.

@directionless
Copy link
Author

I can't tell.

The docs say exec uses the underlying CreateProcess call, but also that the caller ceases, and all files are open in the new process.

Looking a bit more, it looks like os.Exec wraps os.StartProcess, which wraps syscall.StartProcess which, on windows, is CreateProcess. Between those I probably have all the rope there is to have.

Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants