From 9d241e5f5889cf8d37c3a8054b3e55157549c283 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Tue, 15 Nov 2022 13:01:15 +1100 Subject: [PATCH] fix(system-open): use notify for system-open failures and tidy messages --- lua/nvim-tree/actions/node/system-open.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/nvim-tree/actions/node/system-open.lua b/lua/nvim-tree/actions/node/system-open.lua index 861d0908..aecb7f9d 100644 --- a/lua/nvim-tree/actions/node/system-open.lua +++ b/lua/nvim-tree/actions/node/system-open.lua @@ -1,3 +1,5 @@ +local notify = require "nvim-tree.notify" + local M = { config = { is_windows = vim.fn.has "win32" == 1 or vim.fn.has "win32unix" == 1, @@ -27,14 +29,13 @@ function M.fn(node) process.stderr:close() process.handle:close() if code ~= 0 then - process.errors = process.errors .. string.format("NvimTree system_open: return code %d.", code) - error(process.errors) + notify.warn(string.format("system_open failed with return code %d: %s", code, process.errors)) end end ) table.remove(process.args) if not process.handle then - error("\n" .. process.pid .. "\nNvimTree system_open: failed to spawn process using '" .. process.cmd .. "'.") + notify.warn(string.format("system_open failed to spawn command '%s': %s", process.cmd, process.pid)) return end vim.loop.read_start(process.stderr, function(err, data)