robinovitch61 / wander

A terminal app/TUI for HashiCorp Nomad
MIT License
442 stars 17 forks source link

exec from the TUI breaks when multiple wanders exist in $PATH and doesn't pass env vars #116

Closed coderigo closed 11 months ago

coderigo commented 11 months ago

Describe the bug The spawned wander here points to a different binary than the one that started the current process and potentially does not read the original process's env vars or config params.

To reproduce Steps to reproduce the behavior:

  1. install wander<0.14.0 somewhere default, say where homebrew finds it
  2. install wander@0.14.0 somewhere not in your $PATH
  3. run wander and try to exec into an alloc, you should see it try to spawn the binary from 1 above

Expected behavior

  1. exec may make use of the path returned by os.Executable instead of the string "wander" as well as adding existing env vars to the spawned process and a reference to the config file param to ensure the spawned process uses the same settings as the original running process.

Screenshots If applicable, add screenshots to help explain your problem.

Please complete the following information:

robinovitch61 commented 11 months ago

Hi @coderigo , thanks for trying out v0.14 and opening this issue! What I'm getting here is that there are really 3 bugs at play:

  1. the wander executable run by the exec action should be the same as the running wander executable (right now it resolves to whichever wander executable is in your $PATH)
  2. the cli options passed to the exec action should be the same as those passed to the running wander executable (right now they aren't)
  3. the env vars accessible to the exec action should be the same as those passed to the running wander executable (right now they aren't)

Does that sound right?

coderigo commented 11 months ago

first of all - thanks for a great tool 💪

You've got it bang on. I didn't know if you wanted to treat them as one bug or three separate ones since it all seems to happen in those few lines of code, but yes, exactly what you describe is the issue.

robinovitch61 commented 11 months ago

first of all - thanks for a great tool 💪

You've got it bang on. I didn't know if you wanted to treat them as one bug or three separate ones since it all seems to happen in those few lines of code, but yes, exactly what you describe is the issue.

Thanks! :) Sounds good, I'm happy to keep this as one bug issue. Should be fixed shortly!

coderigo commented 11 months ago

Legend

robinovitch61 commented 11 months ago

@coderigo , mind trying out the fix and letting me know how it looks when you get the chance?

go install github.com/robinovitch61/wander@4172951d37d915e7f02b2660980130992f168e8e

(latest commit on next branch)

coderigo commented 11 months ago

glorious. does what it says on the can 👍 thanks!

robinovitch61 commented 11 months ago

Sweeet. Released in v0.14.1