Skip to content

Commit

Permalink
[lua] Allow desk tools to use popen
Browse files Browse the repository at this point in the history
[plugins] Add a -C option to gmake (don't ask)
  • Loading branch information
hgy29 committed Sep 28, 2018
1 parent c78a174 commit de9350b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 6 additions & 2 deletions lua/src/luaconf.h
Expand Up @@ -680,7 +680,9 @@ union luai_Cast { double l_d; long l_l; };
@* the file streams.
** CHANGE it if you have a way to implement it in your system.
*/
/*

#ifdef DESKTOP_TOOLS

#if defined(LUA_USE_POPEN)

#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m))
Expand All @@ -698,12 +700,14 @@ union luai_Cast { double l_d; long l_l; };
#define lua_pclose(L,file) ((void)((void)L, file), 0)

#endif
*/

#else

#define lua_popen(L,c,m) ((void)((void)c, m), \
luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
#define lua_pclose(L,file) ((void)((void)L, file), 0)

#endif


/*
Expand Down
12 changes: 8 additions & 4 deletions plugins/gmake.lua
Expand Up @@ -1173,10 +1173,14 @@ local main = function(args)
print(docs.help)
return

elseif option == "-c" then
print("Do you want to create a new skeleton plugin.def.lua file in this directory? (y/n)")
local res = io.read()
if res:match("^[Yy]$") then
elseif option == "-c" or option == "-C" then
local proceed = true
if option == "-c" then
print("Do you want to create a new skeleton plugin.def.lua file in this directory? (y/n)")
local res = io.read()
proceed=res:match("^[Yy]$")
end
if proceed then
local file = io.open("plugin.def.lua", "r")
if file then
print("\nplugin.def.lua exists, please check file and delete manually if you really want to overwrite.\n")
Expand Down

0 comments on commit de9350b

Please sign in to comment.