terraform-exec icon indicating copy to clipboard operation
terraform-exec copied to clipboard

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

Open kristina-solovyova opened this issue 2 years ago • 2 comments

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

kristina-solovyova avatar Oct 20 '23 17:10 kristina-solovyova

CLA assistant check
All committers have signed the CLA.

hashicorp-cla avatar Oct 20 '23 17:10 hashicorp-cla