[lxc-devel] [lxd/master] lxc/console: Missing error handling
stgraber on Github
lxc-bot at linuxcontainers.org
Fri Jul 10 22:16:31 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200710/5676b671/attachment.bin>
-------------- next part --------------
From 283565ec6e1a61353b26e3220fc495ceb2d5b36e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 10 Jul 2020 18:15:59 -0400
Subject: [PATCH] lxc/console: Missing error handling
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxc/console.go | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lxc/console.go b/lxc/console.go
index 40133f76a1..1646c5a3db 100644
--- a/lxc/console.go
+++ b/lxc/console.go
@@ -303,11 +303,17 @@ func (c *cmdConsole) vga(d lxd.InstanceServer, name string) error {
// Use either spicy or remote-viewer if available.
spicy, err := exec.LookPath("spicy")
if err == nil {
- shared.RunCommand(spicy, fmt.Sprintf("--uri=spice+unix://%s", socket))
+ _, err := shared.RunCommand(spicy, fmt.Sprintf("--uri=spice+unix://%s", socket))
+ if err != nil {
+ return err
+ }
} else {
remoteViewer, err := exec.LookPath("remote-viewer")
if err == nil {
- shared.RunCommand(remoteViewer, fmt.Sprintf("spice+unix://%s", socket))
+ _, err := shared.RunCommand(remoteViewer, fmt.Sprintf("spice+unix://%s", socket))
+ if err != nil {
+ return err
+ }
} else {
fmt.Println(i18n.G("LXD automatically uses either spicy or remote-viewer when present."))
fmt.Println(i18n.G("As neither could be found, the raw SPICE socket can be found at:"))
More information about the lxc-devel
mailing list