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

Allow using a new process group for the terraform cli child process #418

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

Conversation

kristina-solovyova
Copy link

Support using syscall.SysProcAttr with Setpgid: true on the Cmd struct, which creates a new process group for the child process.
This effectively separates the child process from the parent process's signal group, so it won't receive the interrupt signal when you interrupt the parent process.
Motivation - graceful shutdown implementation. When receiving CTRL+C the child process running terraform is interrupted, which is undesirable for my use case.

See: https://stackoverflow.com/questions/33165530/prevent-ctrlc-from-interrupting-exec-command-in-golang/33171307#33171307

@hashicorp-cla
Copy link

hashicorp-cla commented Oct 20, 2023

CLA assistant check
All committers have signed the CLA.

@kristina-solovyova kristina-solovyova changed the title feat: allow using a new process group for the terraform cli child process Allow using a new process group for the terraform cli child process Oct 20, 2023
@kristina-solovyova kristina-solovyova force-pushed the add-use-separate-process-group-option branch from f497b4e to 998b5f0 Compare May 1, 2024 12:24
@spirit1431007
Copy link

How about Windows, we can use CREATE_NEW_PROCESS_GROUP

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.

3 participants