File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,13 @@ function M.get_node_version()
17
17
local cmd_output_table = vim .fn .executable (M .node_command ) == 1 and vim .fn .systemlist (cmd , nil , 0 ) or { " " }
18
18
local cmd_output = cmd_output_table [# cmd_output_table ]
19
19
local cmd_exit_code = vim .v .shell_error
20
+ local node_version_major = 0
21
+ local node_version = " "
20
22
21
- local node_version = string.match (cmd_output , " ^v(%S+)" ) or " "
22
- local node_version_major = tonumber (string.match (node_version , " ^(%d+)%." )) or 0
23
+ if cmd_output then
24
+ node_version = string.match (cmd_output , " ^v(%S+)" ) or node_version
25
+ node_version_major = tonumber (string.match (node_version , " ^(%d+)%." )) or node_version_major
26
+ end
23
27
24
28
if node_version_major == 0 then
25
29
M .node_version_error = table.concat ({
@@ -33,7 +37,7 @@ function M.get_node_version()
33
37
M .node_version_error = string.format (" Node.js version 20 or newer required but found %s" , node_version )
34
38
end
35
39
36
- M .node_version = node_version or " "
40
+ M .node_version = node_version
37
41
end
38
42
39
43
return M .node_version , M .node_version_error
You can’t perform that action at this time.
0 commit comments