Skip to content

Commit

Permalink
lpm: add prompt when lpm is run outside the console (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
takase1121 authored Dec 3, 2024
1 parent de9ec6c commit 4e09d07
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1998,6 +1998,10 @@ int main(int argc, char* argv[]) {
#else
lua_pushboolean(L, isatty(fileno(stdout)));
#endif
#if _WIN32
lua_pushboolean(L, GetConsoleProcessList(&(DWORD){ 0 }, 1) == 1);
lua_setglobal(L, "LPM_RUN_FROM_GUI");
#endif
lua_setglobal(L, "TTY");
#if _WIN32
lua_pushliteral(L, "\\");
Expand Down
4 changes: 4 additions & 0 deletions src/lpm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2588,6 +2588,10 @@ not commonly used publically.
[target] target, or the current working directory.
]]
)
if LPM_RUN_FROM_GUI then
io.stderr:write(colorize("\n\nYou can close this window by pressing Enter.", "cyan"))
io.stdin:read("*l")
end
return 0
end

Expand Down

0 comments on commit 4e09d07

Please sign in to comment.