-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Hooks do not update if written from export-env #8856
Copy link
Copy link
Closed
Labels
A:hooksHooks are used to react to changes during interactive executionHooks are used to react to changes during interactive executioncategory:bugSomething isn't workingSomething isn't working
Milestone
Description
Describe the bug
If you update a $env.config.hooks variable from within a export-env, which has been loaded via overlay use from the $nu.config-path it is written, but not updated/applied (it does nothing, but after writing to it again both work)
How to reproduce
prepare files for it
env.nu:
let-env config = {
hooks: {
pre_prompt: []
pre_execution: []
env_change: {}
}
)config.nu:
overlay use test.nutest.nu:
export-env {
let-env config = ($env.config | upsert hooks.pre_execution {|config|
$config.hooks.pre_execution
| append {||
print 'TEST'
}
})
}reproduce it
load via nu --env-config env.nu --config config.nu -> no pre-exec hook works
update the hook config again
run
let-env config = ($env.config | upsert hooks.pre_execution {|config|
$config.hooks.pre_execution
| append {||
print 'TEST-2'
}
})-> 2 pre-exec hooks work
verify its a issue with use and not something else
mv test.nu config.nu -fnu --env-config env.nu --config config.nu- enter anything (trigger
pre_execution) - it works
Expected behavior
it should work either way
Screenshots
No response
Configuration
| key | value |
|---|---|
| version | 0.78.1 |
| branch | |
| commit_hash | |
| build_os | linux-x86_64 |
| build_target | x86_64-unknown-linux-gnu |
| rust_version | rustc 1.67.1 (d5a82bbd2 2023-02-07) (built from a source tarball) |
| cargo_version | cargo 1.67.0 |
| build_time | 1980-01-01 00:00:00 +00:00 |
| build_rust_channel | release |
| features | default, zip |
| installed_plugins |
i self-compiled it via nix (buildscript) - the commit hash is: d0a83fec693e50fbe38780aaec932f6b8cc8ed0a (newer than 0.78)
This bug has been around since at least 0.69.0 (i was to lazy to figure out the exact issue back then, but have it documented - my setup back then was based on official releases and popos & ubuntu)
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A:hooksHooks are used to react to changes during interactive executionHooks are used to react to changes during interactive executioncategory:bugSomething isn't workingSomething isn't working