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

[BUG] subprocess fails on non-default environments #398

Closed
przepompownia opened this issue Apr 25, 2024 · 1 comment
Closed

[BUG] subprocess fails on non-default environments #398

przepompownia opened this issue Apr 25, 2024 · 1 comment
Assignees

Comments

@przepompownia
Copy link

przepompownia commented Apr 25, 2024

NeoVim Version
v0.10.0-dev-3003+ge0d92b9cc

Describe the bug
If the main nvim process starts with non-default XDG_* and runtimepath directories, the child process seems to not respect those settings. In effect it, for example, cannot find neotest module.

To Reproduce
The project https://github.com/przepompownia/neotest-phpunit-example (on 22a8004a3198a3f4db494f6fbda5752c80745fa3) maybe isn't minimal for this bug but simply shows what happens. From its directory run

make start

and look into .xdg/state/nvim/neotest.log. I see

ERROR | 2024-04-25T15:48:25Z+0200 | ...-strategy/plugins/neotest/lua/neotest/lib/subprocess.lua:76 | Failed to initialize child process Vim:Error invoking 'nvim_exec_lua' on channel 3:
Error executing lua: [string "<nvim>"]:1: module 'neotest' not found:
	no field package.preload['neotest']
	no file './neotest.lua'
	no file '/usr/share/luajit-2.1/neotest.lua'
	no file '/usr/local/share/lua/5.1/neotest.lua'
	no file '/usr/local/share/lua/5.1/neotest/init.lua'
	no file '/usr/share/lua/5.1/neotest.lua'
	no file '/usr/share/lua/5.1/neotest/init.lua'
	no file './neotest.so'
	no file '/usr/local/lib/lua/5.1/neotest.so'
	no file '/usr/lib/x86_64-linux-gnu/lua/5.1/neotest.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
	[C]: in function 'require'
	[string "<nvim>"]:1: in main chunk
stack traceback:
	[C]: in function 'rpcrequest'
	...-strategy/plugins/neotest/lua/neotest/lib/subprocess.lua:61: in function <...-strategy/plugins/neotest/lua/neotest/lib/subprocess.lua:54>
	[C]: in function 'xpcall'
	...-strategy/plugins/neotest/lua/neotest/lib/subprocess.lua:54: in function 'init'
	...dap-strategy/plugins/neotest/lua/neotest/client/init.lua:374: in function '_start'
	...dap-strategy/plugins/neotest/lua/neotest/client/init.lua:188: in function '_ensure_started'
	...dap-strategy/plugins/neotest/lua/neotest/client/init.lua:173: in function 'get_adapters'
	...lugins/neotest/lua/neotest/consumers/summary/summary.lua:114: in function <...lugins/neotest/lua/neotest/consumers/summary/summary.lua:113>

init.lua provided there contains all relevant things (XDG_* and runtimepath).

On the other side I don't see any practical effect of this error.

@przepompownia
Copy link
Author

I updated https://github.com/przepompownia/neotest-phpunit-example to behave closer to standard and no longer get such error. Not sure how much fixing this error is worth effort so I close this PR at the moment.

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