Do not print error on standard output

Delayed error when passing invalid directory argument.
This commit is contained in:
Francesco Abbate 2021-02-19 09:29:46 +01:00
parent 6fcdafc5b6
commit 114f6b2481
1 changed files with 6 additions and 1 deletions

View File

@ -369,6 +369,7 @@ function core.init()
local project_dir = core.recent_projects[1] or "."
local project_dir_explicit = false
local files = {}
local delayed_error
for i = 2, #ARGS do
local arg_filename = strip_trailing_slash(ARGS[i])
local info = system.get_file_info(arg_filename) or {}
@ -382,7 +383,7 @@ function core.init()
project_dir = arg_filename
project_dir_explicit = true
else
print(string.format("error: invalid file or directory %q", ARGS[i]))
delayed_error = string.format("error: invalid file or directory %q", ARGS[i])
end
end
@ -437,6 +438,10 @@ function core.init()
core.root_view:open_doc(core.open_doc(filename))
end
if delayed_error then
core.error(delayed_error)
end
if got_plugin_error or got_user_error or got_project_error then
command.perform("core:open-log")
end