From 5668f28f46ec77eb3293c9aa0c29f5c9c4f5ce38 Mon Sep 17 00:00:00 2001 From: vadym Date: Wed, 7 Dec 2022 20:31:59 +0200 Subject: [PATCH] build tags fix --- contrib/ui/mesh-ui/webview.go | 23 ---------------------- contrib/ui/mesh-ui/webview_other.go | 30 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 23 deletions(-) create mode 100644 contrib/ui/mesh-ui/webview_other.go diff --git a/contrib/ui/mesh-ui/webview.go b/contrib/ui/mesh-ui/webview.go index fe9b4bd9..8daf311a 100755 --- a/contrib/ui/mesh-ui/webview.go +++ b/contrib/ui/mesh-ui/webview.go @@ -8,7 +8,6 @@ import ( "net" "net/url" "os" - "os/exec" "path/filepath" "runtime" "strconv" @@ -176,28 +175,6 @@ func run(w webview.WebView) { }) } -func run_command(command string) []byte { - args := []string{"-json", command} - cmd := exec.Command(riv_ctrl_path, args...) - out, err := cmd.CombinedOutput() - if err != nil { - //log.Fatalf("cmd.Run() failed with %s\n", err) - return []byte(err.Error()) - } - return out -} - -func run_command_with_arg(command string, arg string) []byte { - args := []string{"-json", command, arg} - cmd := exec.Command(riv_ctrl_path, args...) - out, err := cmd.CombinedOutput() - if err != nil { - //log.Fatalf("command failed: %s\n", riv_ctrl_path+" "+strings.Join(args, " ")) - return []byte(err.Error()) - } - return out -} - func add_peers(uri string) { run_command_with_arg("addpeers", "uri="+uri) } diff --git a/contrib/ui/mesh-ui/webview_other.go b/contrib/ui/mesh-ui/webview_other.go new file mode 100644 index 00000000..223bef3f --- /dev/null +++ b/contrib/ui/mesh-ui/webview_other.go @@ -0,0 +1,30 @@ +//go:build !windows +// +build !windows + +package main + +import ( + "os/exec" +) + +func run_command(command string) []byte { + args := []string{"-json", command} + cmd := exec.Command(riv_ctrl_path, args...) + out, err := cmd.CombinedOutput() + if err != nil { + //log.Fatalf("cmd.Run() failed with %s\n", err) + return []byte(err.Error()) + } + return out +} + +func run_command_with_arg(command string, arg string) []byte { + args := []string{"-json", command, arg} + cmd := exec.Command(riv_ctrl_path, args...) + out, err := cmd.CombinedOutput() + if err != nil { + //log.Fatalf("command failed: %s\n", riv_ctrl_path+" "+strings.Join(args, " ")) + return []byte(err.Error()) + } + return out +}