File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1
1
local util = require " obsidian.util"
2
2
local log = require " obsidian.log"
3
3
local RefTypes = require (" obsidian.search" ).RefTypes
4
- local run_job = require (" obsidian.async" ).run_job
5
4
6
5
--- @param client obsidian.Client
7
6
return function (client , data )
@@ -56,6 +55,8 @@ return function(client, data)
56
55
uri = (" obsidian://open?vault=%s&file=%s" ):format (encoded_vault , encoded_path )
57
56
end
58
57
58
+ uri = vim .fn .shellescape (uri )
59
+
59
60
--- @type string , string[]
60
61
local cmd , args
61
62
if this_os == util .OSType .Linux then
@@ -81,5 +82,14 @@ return function(client, data)
81
82
82
83
assert (cmd )
83
84
assert (args )
84
- run_job (cmd , args )
85
+
86
+ local cmd_with_args = cmd .. " " .. table.concat (args , " " )
87
+ vim .fn .jobstart (cmd_with_args , {
88
+ detach = true ,
89
+ on_exit = function (_ , exit_code )
90
+ if exit_code ~= 0 then
91
+ log .err (" open command failed with exit code '%s': %s" , exit_code , cmd_with_args )
92
+ end
93
+ end ,
94
+ })
85
95
end
You can’t perform that action at this time.
0 commit comments