`modules/background_task/task.nu`: can not use a module inside closure in current directory.
Nobody has claimed this yet.
- Dominant language
- Nushell
- Stars
- 1.3k
- Forks
- 323
- Avg merge
- 2h 55m
- Merged PRs (30d)
- 3
Description
Given tmp.nu in home directory, or any other directory except /tmp
I cannot run task spawn with the following closure:
task spawn { print $env.PWD; use tmp.nu }
When I run task log, it reports the following error message:
Error: nu::parser::module_not_found
x Module not found.
,-[/tmp/tmp.Id6nNnlTch-nu-task:1:22]
1 | print $env.PWD; use tmp.nu
: ^^^|^^
: `-- module tmp.nu not found
`----
help: module files and their paths must be available before your script is
run as parsing occurs before anything is evaluated
I believe it's because task spawn save the closure into a temporary file, which makes nushell doesn't try to load module from current directory. I don't think it's a nushell issue, maybe we can just change task.nu to fix it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in modules/background_task/task.nu and reproduce the reported task spawn closure with tmp.nu in the current directory, then inspect how the closure is saved and run. Done means task spawn can use a module from the current directory and task log no longer reports module_not_found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100