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
Adds 'shell' command. #492
base: master
Are you sure you want to change the base?
Conversation
Adds the 'luarocks shell' command, that launches a new shell with the environment variables LUA_PATH and LUA_CPATH set with the values configured when installing LuaRocks.
-- @return boolean This function always succeeds. | ||
function shell_cmd.run(...) | ||
local lr_path, lr_cpath = cfg.package_paths() | ||
local path_sep = cfg.export_path_separator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused
I've been experimenting locally with this idea too. @Tieske suggested this could be implemented as a command, I think it also needs to set the PATH, and add not only the path of bin/ entries for the active rock trees in it, but also the path of the LuaRocks binaries itself. (i.e. it should be guaranteed that a plain In any case, having something like |
Ok, thanks both @hishamhm and @mpeterv for the pointers. I'll update this PR, but the possibility of generating a script at install time is not something I would oppose. In the "cons" section of the |
@hishamhm could you share the script you're using? I'm taking a look at what would be needed to generate it and while the Windows side of things is clear to me, I'm a bit lost as to what to do on the "other" side :) |
This ended up falling on the wayside, sorry. My initial attempt at a stand-alone #!/bin/sh
export PATH=$(dirname $(readlink -f "$0"))":$PATH"
eval $(luarocks path --bin)
export LUA_PATH LUA_CPATH PATH
exec "$SHELL" "$@" This is finding the path of the binary dynamically and using |
e237af3
to
0477604
Compare
I like this approach (just ran into this PR for the first time, dunno how I missed it before) If the script is part of the LR installation, then based on its own location it would be able to find everything it needs right? No need to do hardcoded install time stuff... |
@Tieske Would it be possible to launch a CMD instance that auto-runs the Visual Studio setup batch file on startup then gives you an interactive shell? This would be necessary to give us a "shell that works" on Windows. (We could also check that this Visual Studio batch file can be found during INSTALL.BAT) |
That is already the case (if it could be found) see https://github.com/luarocks/luarocks/blob/master/install.bat#L960 |
Adds the 'luarocks shell' command, that launches a new shell with the environment variables LUA_PATH and LUA_CPATH set with the values configured when installing LuaRocks.
This was suggested here.