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

sbtn should reevaluate env variables #7012

Open
agilesteel opened this issue Aug 29, 2022 · 5 comments
Open

sbtn should reevaluate env variables #7012

agilesteel opened this issue Aug 29, 2022 · 5 comments
Labels
area/sbtn thin client issues Bug

Comments

@agilesteel
Copy link

agilesteel commented Aug 29, 2022

steps

Given a hello world application that reads out an environment variable and prints it out:

@main def Main(args: String*): Unit =
  println(System.getenv("FOO"))

Then run:

FOO=BAR sbtn run

problems

I see null.

expectations

I see BAR

notes

When I run:

FOO=BAR bloop run my-project

I correctly see BAR

In fact the sbtn behavior is flaky. It depends on how the server was started. If the server was not running to begin with, then yes

FOO=BAR sbtn run

will indeed print out BAR and the subsequent requests as well. However as soon as we change it to

FOO=NOT_BAR sbtn run

we will keep seeing the incorrect BAR.

original report

I'm not sure whether it's an issue or a feature request. I already created a feature request here: https://discuss.lightbend.com/t/feature-request-sbtn-should-reevaluate-env-variables/9908 but haven't heard anything in over 2 weeks so I'm opening an issue here as well.

@agilesteel agilesteel added the Bug label Aug 29, 2022
@laughedelic
Copy link
Member

I think this issue is related:

@eed3si9n
Copy link
Member

I don't monitor Lightbend forums since I no longer work there. We have https://github.com/sbt/sbt/discussions for discussions, but I'm happy to discuss this issue/feature here.

@eed3si9n eed3si9n added the area/sbtn thin client issues label Aug 31, 2022
@agilesteel
Copy link
Author

Yeah no worries @eed3si9n it's just that submitting a feature request here points to the Lightbend forums which is why I submitted it there.

So is this a bug or a limitation of the current implementation?

@SethTisue
Copy link
Member

it's just that submitting a feature request here points to the Lightbend forums which is why I submitted it there.

ahhhh, https://github.com/sbt/sbt/blob/1.8.x/.github/ISSUE_TEMPLATE/--feature-request.md needs updating, thanks for bringing that up. @eed3si9n I guess you know best what URL and wording you want

@eed3si9n
Copy link
Member

Thanks both. I've fixed the issue template 5bd4405.

So is this a bug or a limitation of the current implementation?

It's hard to say. Strictly speaking, as sbt, this is working as intended because sbt emulates run (JVM process) using a function call reusing the JVM already started by sbt server.

However, the spirit of sbtn is to make it work seamlessly with the shell environment (bash, zsh etc) so your expectation also makes sense as the future direction of sbtn. Somewhat related:

A feature that I've always wanted is letting individual client like sbtn execute the program when run is requested (#6178), which should largely solve this problem of env variable inheritance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sbtn thin client issues Bug
Projects
None yet
Development

No branches or pull requests

4 participants