Skip to content
This repository was archived by the owner on Feb 19, 2023. It is now read-only.

Commit e84c8ed

Browse files
protexpmaggio-via
authored andcommitted
Fix fake output on std_error
1 parent a58e35d commit e84c8ed

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

lua/neuron/cmd.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function M.new_edit(neuron_dir)
8585
command = "neuron",
8686
args = {"new"},
8787
cwd = neuron_dir,
88-
-- on_stderr = utils.on_stderr_factory("neuron new"),
88+
on_stderr = utils.on_stderr_factory("neuron new"),
8989
interactive = false,
9090
on_exit = vim.schedule_wrap(
9191
function(job, return_val)

lua/neuron/utils.lua

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,26 @@ function M.path_from_id(id, neuron_dir, callback)
2323
}:start()
2424
end
2525

26+
local fake_errors = {
27+
[[%s*Plugins enabled:]],
28+
[[%s*Loading directory tree]],
29+
[[%s*Building graph]]
30+
}
31+
32+
function M.is_an_error(data)
33+
for i=1,#fake_errors do
34+
if data:match(fake_errors[i]) then
35+
return false
36+
end
37+
end
38+
return true
39+
end
40+
2641
function M.on_stderr_factory(name)
2742
return vim.schedule_wrap(
2843
function(error, data)
2944
assert(not error, error)
30-
if data ~= nil then
45+
if data ~= nil and M.is_an_error(data) then
3146
vim.cmd(string.format("echoerr 'An error occured from running %s: %s'", name, data))
3247
end
3348
end

0 commit comments

Comments
 (0)