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

Use syscall.Exec instead of cmd.Run in non-windows environment #77

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Songmu
Copy link

@Songmu Songmu commented Jun 17, 2019

Using syscall.Exec makes the process tree simpler and is useful when you want the child process to handle the signal.

For example, the direnv program internally uses syscall.Exec.

https://github.com/direnv/direnv/blob/5b8f7d0ade4248e04899015e8628408b6f4becf3/cmd_exec.go#L67

How about it?

hoshsadiq added a commit to hoshsadiq/godotenv that referenced this pull request Nov 23, 2021
Using exec is better in this case as it makes the process tree simpler,
and allows the child's signals to be handled by the caller. In addition
the `Exec` function has been removed as it's not really great as a
library function. Users should manually call the `Load` function and
run `exec.Command` or `syscall.Exec` appropriately.

In the future we probably want to handle signals for Windows anyway.

This is based on joho/godotenv#77 and also
addresses the following PRs in upstream:

- joho/godotenv#119
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant