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

Running terraform with tenv in PowerShell on Linux #327

Open
simongottschlag opened this issue Dec 31, 2024 · 3 comments
Open

Running terraform with tenv in PowerShell on Linux #327

simongottschlag opened this issue Dec 31, 2024 · 3 comments
Labels
question Further information is requested TENV_DETACHED_PROXY

Comments

@simongottschlag
Copy link

Describe the bug
When running terraform (and most likely tofu) from PowerShell (pwsh) on Linux, the pwsh session will be suspended after terraform exits.

To Reproduce
Steps to reproduce the behavior:

  1. Install latest version of tenv on Ubuntu 24.04
  2. Install latest version of terraform using tenv
  3. Install latest version of PowerShell (pwsh)
  4. Start PowerShell
  5. Run terraform version (or any other terraform command)

Expected behavior
PowerShell should continue to function after terraform exits.

Additional context
The problem is due to tenv lightproxy placing terraform as foreground before starting it. Confirmed that setting TENV_DETACHED_PROXY fixes the problem. Also recreated the issue manually and confirmed that it's foreground that causes the issue.

@kvendingoldo kvendingoldo added question Further information is requested TENV_DETACHED_PROXY labels Dec 31, 2024
@creeder-uturn
Copy link

creeder-uturn commented Jan 15, 2025

Confirmed that setting TENV_DETACHED_PROXY fixes the problem

I tested this on Powershell on Mac (which I believe will behave the same way), and to clarify a bit: I saw this behavior when $env:TENV_DETACHED_PROXY is set to $True.

The behavior goes away when setting it to $False. Unfortunately, this makes the original bug come back (cntrl+c immediately exits without gracefully shutting down). (Related #255 / #304)

Some more data. Not good news, unfortunately.

@simongottschlag Can you confirm if you meant that when you set TENV_DETACHED_PROXY to $False it fixed the problem? Or was the behavior on Linux that setting it to $True fixed it?

@simongottschlag
Copy link
Author

Hey @creeder-uturn!

It's the same. You need it to return here: https://github.com/tofuutils/tenv/blob/main/versionmanager/proxy/detach/detached_others.go#L40

The problem starts when setting the foreground flag for the new process.

@dvaumoron
Copy link
Contributor

Can you test v4.2.0-beta2 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested TENV_DETACHED_PROXY
Projects
None yet
Development

No branches or pull requests

4 participants