nushell/tests
Devyn Cairns 390a7e3f0b
Add environment engine calls for plugins (#12166)
# Description

This adds three engine calls: `GetEnvVar`, `GetEnvVars`, for getting
environment variables from the plugin command context, and
`GetCurrentDir` for getting the current working directory.

Plugins are now launched in the directory of their executable to try to
make improper use of the current directory without first setting it more
obvious. Plugins previously launched in whatever the current directory
of the engine was at the time the plugin command was run, but switching
to persistent plugins broke this, because they stay in whatever
directory they launched in initially.

This also fixes the `gstat` plugin to use `get_current_dir()` to
determine its repo location, which was directly affected by this
problem.

# User-Facing Changes
- Adds new engine calls (`GetEnvVar`, `GetEnvVars`, `GetCurrentDir`)
- Runs plugins in a different directory from before, in order to catch
bugs
- Plugins will have to use the new engine calls if they do filesystem
stuff to work properly

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting
- [ ] Document the working directory behavior on plugin launch
- [ ] Document the new engine calls + response type (`ValueMap`)
2024-03-12 06:34:32 -05:00
..
assets/nu_json Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00
const_ Fix const string interpolation test (#12038) 2024-03-01 16:35:07 -08:00
eval Exit early when encountering parsing errors (#10213) 2023-09-05 14:36:37 +02:00
fixtures Update tests Playground (#12134) 2024-03-08 20:31:21 -08:00
hooks Auto-expand table based on terminal width (#9934) 2023-08-08 05:47:23 -05:00
modules Evaluate string interpolation at parse time (#11562) 2024-01-22 09:13:48 +02:00
overlays Fix overlay_use_main_not_exported hanging when an external spam command exists (#11261) 2023-12-08 06:08:38 -06:00
parsing Forbid reserved variable names for function arguments (#11169) 2023-11-29 18:29:07 +01:00
path change canonicalize test use a more deeply rooted folder (#10685) 2023-10-11 11:27:25 -05:00
plugin_persistence Make the plugin persistence GC delay test more reliable (#12153) 2024-03-11 12:01:48 +01:00
plugins Add environment engine calls for plugins (#12166) 2024-03-12 06:34:32 -05:00
scope add $.extra_usage to modules (#11649) 2024-01-27 17:49:21 +02:00
shell do command: Make closure support default parameters and type checking (#12056) 2024-03-11 18:11:08 +08:00
main.rs Keep plugins persistently running in the background (#12064) 2024-03-09 17:10:22 -06:00