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

Can't set an environment variable in a task #10851

Closed
deech opened this issue Mar 9, 2019 · 4 comments
Closed

Can't set an environment variable in a task #10851

deech opened this issue Mar 9, 2019 · 4 comments

Comments

@deech
Copy link
Contributor

deech commented Mar 9, 2019

I don't seem to be able to set an environment variable in a nimble task, am I missing something?

task t, "t":
   echo existsEnv("FOO")
   putEnv("FOO", "foo")
   echo getEnv("FOO")

Doing nimble t outputs:

false
          <-- note empty line
@genotrance
Copy link
Contributor

putEnv isn't implemented in nimble's VM.

https://github.com/nim-lang/nimble/blob/master/src/nimblepkg/nimscriptsupport.nim

I had originally authored a PR for this.

nim-lang/nimble#541

My current idea is to remove the VM altogether and run nimble scripts through Nim. It is still TBD.

@Araq
Copy link
Member

Araq commented Mar 10, 2019

My current idea is to remove the VM altogether and run nimble scripts through Nim. It is still TBD.

If it helps to motivate you, I'm really looking forward to this! :-)

@dom96
Copy link
Contributor

dom96 commented Mar 17, 2019

@genotrance I'm still skeptical about the performance of this. Sure, you can cache it but the performance will still be horrible when installing packages as most of them are going to be new. This won't be a problem for now when we don't have a lot of packages but in the future it'll become a massive scalability problem.

I would personally much rather push the nimscript evaluation to the Nim binary, this would free Nimble of this horrible dependency, which would have a number of advantages:

  • Tons of compatibility problems: Nim and Nimble would not longer have a chance of diverging.
  • There would be no issues introduced as a result of the Nim compiler evolving.
  • Much smaller Nimble binaries
  • This would be much faster than your approach

@genotrance
Copy link
Contributor

This has been fixed in Nimble and works as expected now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants