mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #9081 from jamessan/embed-crash
Fix crash if --embed is used more than once
This commit is contained in:
commit
94e585944d
@ -258,6 +258,14 @@ int main(int argc, char **argv)
|
||||
// Process the command line arguments. File names are put in the global
|
||||
// argument list "global_alist".
|
||||
command_line_scan(¶ms);
|
||||
|
||||
if (embedded_mode) {
|
||||
const char *err;
|
||||
if (!channel_from_stdio(true, CALLBACK_READER_INIT, &err)) {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
server_init(params.listen_addr);
|
||||
|
||||
if (GARGCOUNT > 0) {
|
||||
@ -848,10 +856,6 @@ static void command_line_scan(mparm_T *parmp)
|
||||
headless_mode = true;
|
||||
} else if (STRICMP(argv[0] + argv_idx, "embed") == 0) {
|
||||
embedded_mode = true;
|
||||
const char *err;
|
||||
if (!channel_from_stdio(true, CALLBACK_READER_INIT, &err)) {
|
||||
abort();
|
||||
}
|
||||
} else if (STRNICMP(argv[0] + argv_idx, "listen", 6) == 0) {
|
||||
want_argument = true;
|
||||
argv_idx += 6;
|
||||
|
@ -4,6 +4,7 @@ local Screen = require('test.functional.ui.screen')
|
||||
local clear = helpers.clear
|
||||
local command = helpers.command
|
||||
local eq = helpers.eq
|
||||
local eval = helpers.eval
|
||||
local feed = helpers.feed
|
||||
local funcs = helpers.funcs
|
||||
local nvim_prog = helpers.nvim_prog
|
||||
@ -196,5 +197,10 @@ describe('startup', function()
|
||||
funcs.system({nvim_prog, '-n', '-es' },
|
||||
{ 'set encoding', '' }))
|
||||
end)
|
||||
|
||||
it('does not crash if --embed is given twice', function()
|
||||
clear{args={'--embed'}}
|
||||
eq(2, eval('1+1'))
|
||||
end)
|
||||
end)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user