Skip to content

Commit fbf00e6

Browse files
committed
Do not check limactl list exit code
Starting from lima v0.22.0 (I guess) `limactl ls <vm>` returns 1, when the <vm> doesn't exist. That breaks many plans because list and status tasks fails instead of returning empty result. This commit removes the `limactl list` return code check. Maybe later we can improve it. Fixes #31
1 parent 26500cd commit fbf00e6

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/cli_helper.rb

+2-8
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,15 @@ def version
4040

4141
def list(vm_names = [])
4242
lima_cmd = [@limactl, 'list', '--json'] + vm_names
43-
stdout_str, stderr_str, status = Open3.capture3(*lima_cmd)
44-
unless status.success?
45-
raise LimaError, "`#{lima_cmd.join(' ')}` failed with status #{status.exitstatus}: #{stderr_str}"
46-
end
43+
stdout_str, _stderr_str, _status = Open3.capture3(*lima_cmd)
4744

4845
stdout_str.split("\n").map { |vm| JSON.parse(vm) }
4946
end
5047

5148
# A bit faster `list` variant to check the VM status
5249
def status(vm_name)
5350
lima_cmd = [@limactl, 'list', '--format', '{{ .Status }}', vm_name]
54-
stdout_str, stderr_str, status = Open3.capture3(*lima_cmd)
55-
unless status.success?
56-
raise LimaError, "`#{lima_cmd.join(' ')}` failed with status #{status.exitstatus}: #{stderr_str}"
57-
end
51+
stdout_str, _stderr_str, _status = Open3.capture3(*lima_cmd)
5852

5953
stdout_str.chomp
6054
end

0 commit comments

Comments
 (0)