mirror of
https://github.com/neovim/neovim.git
synced 2025-12-02 23:13:01 +00:00
shada: Fix non-writeable ShaDa directory handling
Before this change,
nvim -i /etc/shada
segfaults on exit if the file does not exist and user does not have
permissions to create the file at /etc/shada.
Closes #5296
Reported in #5277
https://github.com/neovim/neovim/issues/5277#issuecomment-243937255
This commit is contained in:
@@ -8,8 +8,8 @@ local mpack = require('mpack')
|
||||
local tmpname = helpers.tmpname()
|
||||
local additional_cmd = ''
|
||||
|
||||
local function nvim_argv()
|
||||
local argv = {nvim_prog, '-u', 'NONE', '-i', tmpname, '-N',
|
||||
local function nvim_argv(shada_file)
|
||||
local argv = {nvim_prog, '-u', 'NONE', '-i', shada_file or tmpname, '-N',
|
||||
'--cmd', 'set shortmess+=I background=light noswapfile',
|
||||
'--cmd', additional_cmd,
|
||||
'--embed'}
|
||||
@@ -20,8 +20,8 @@ local function nvim_argv()
|
||||
end
|
||||
end
|
||||
|
||||
local reset = function()
|
||||
set_session(spawn(nvim_argv()))
|
||||
local reset = function(shada_file)
|
||||
set_session(spawn(nvim_argv(shada_file)))
|
||||
meths.set_var('tmpname', tmpname)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user