diff options
| author | Robert Günzler <r@gnzler.io> | 2022-05-18 16:25:29 +0200 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2022-05-27 13:16:16 +0200 |
| commit | cfb3bccc73a959ecf34661b2a1b00f0315f707cb (patch) | |
| tree | 4ad52a0681d065b0e31e5f4623862116bae2feb0 /.vim/lua/plugins.lua | |
| parent | c0b5557c3aaf26e7444e2bc0d11256d2ac040e5f (diff) | |
vim: gracefully handle non-existant 'fortune' binary
Diffstat (limited to '.vim/lua/plugins.lua')
| -rw-r--r-- | .vim/lua/plugins.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/.vim/lua/plugins.lua b/.vim/lua/plugins.lua index 86ae9f5..c29d2c2 100644 --- a/.vim/lua/plugins.lua +++ b/.vim/lua/plugins.lua @@ -1012,12 +1012,15 @@ require('packer').startup({function() return { type = 'text', val = function() - local j = require('plenary.job'):new({ + local Job = require('plenary.job') + local ok, j = pcall(Job.new, Job, { command = 'fortune', args = {vim.env.HOME..'/devel/projects/zig/fortune/fortunes'}, enable_recording = true, }) - local lines = j:sync() + if not ok then return {} end + local lines, exit_code = j:sync() + if not exit_code == 0 then return {} end local new = {} for i = 1, #lines do if not (vim.trim(lines[i]) == '') then |