From bcb277c144c4f4e18c46000e48e37e17b476239a Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sat, 14 Mar 2015 10:57:49 -0400 Subject: Prevent -h, --help switches from exiting single instance; core/args.lua --- core/args.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/args.lua b/core/args.lua index 907fd465..b1d87c64 100644 --- a/core/args.lua +++ b/core/args.lua @@ -72,7 +72,14 @@ local function show_help() for k, v in pairs(switches) do print(line:format(k, table.unpack(v, 2))) end os.exit() end -if not CURSES then M.register('-h', '--help', 0, show_help, 'Shows this') end +if not CURSES then + M.register('-h', '--help', 0, show_help, 'Shows this') + -- After Textadept finishes initializing and processes arguments, remove the + -- help switches to prevent another instance from sending '-h' and '--help' to + -- the first instance, killing the latter. + events.connect(events.INITIALIZED, + function() switches['-h'], switches['--help'] = nil, nil end) +end -- For Windows, create arg table from single command line string (arg[0]). if WIN32 and not CURSES and #arg[0] > 0 then -- cgit v1.2.3