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

run() library function should support TMPDIR override #2714

Closed
bershanskiy opened this issue Apr 6, 2023 · 2 comments
Closed

run() library function should support TMPDIR override #2714

bershanskiy opened this issue Apr 6, 2023 · 2 comments

Comments

@bershanskiy
Copy link

Is this a feature request or a bug?

Feature request

What is the current behavior?

web-ext function run takes temporary directory location from environment variable TMPDIR without a way to override it.

What is the expected or desired behavior?

run() function accepts an argument which has a precedence over TMPDIR.

Version information (for bug reports)

  • Firefox version: Any
  • Your OS and version: Linux, Ubuntu 22.10
  • Paste the output of these commands:

v18.7.0
8.18.0
7.5.0

node --version && npm --version && web-ext --version
@bershanskiy
Copy link
Author

This would provide a workaround for #1696 since user could just pass a TMPDIR override directly to run(). Currently user has to override it in a different way:

  • in CLI by running, e.g. TMPDIR=~/tmp web-ext run or TMPDIR=~/tmp node test.js
  • in NodeJS process, e.g. process.env.TMPDIR = '~/tmp'

For reference, I used the second method in my software, but it is not ideal since it overrides environment variable for the entire process.

@Rob--W
Copy link
Member

Rob--W commented Apr 13, 2023

Ultimately tmp package (source) relies on os.tmpdir() (Node.js source). The tmp package supports overriding with tmpdir option, but that only affects the tmp package and not other dependencies if any.

Since there is already a standard option to override the tmp dir (with the environment variable), we are not going to introduce a new option to web-ext to customize it. If you want to use web-ext as a library without affecting other code in your project, use child_process to spawn a new process with its own env where you can override TMPDIR.

@Rob--W Rob--W closed this as completed Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants