Skip to content

Commit c73b2d3

Browse files
committed
draft
1 parent 8429a38 commit c73b2d3

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

systray/exec_default.go

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2022 Arduino SA
2+
//
3+
// This program is free software: you can redistribute it and/or modify
4+
// it under the terms of the GNU Affero General Public License as published
5+
// by the Free Software Foundation, either version 3 of the License, or
6+
// (at your option) any later version.
7+
//
8+
// This program is distributed in the hope that it will be useful,
9+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
// GNU Affero General Public License for more details.
12+
//
13+
// You should have received a copy of the GNU Affero General Public License
14+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
15+
16+
package systray
17+
18+
import "os/exec"
19+
20+
// default execApp from golang
21+
func execApp(path string, args ...string) error {
22+
cmd := exec.Command(path, args...)
23+
return cmd.Start()
24+
}

systray/systray.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package systray
1818
import (
1919
"fmt"
2020
"os"
21-
"os/exec"
2221
"strings"
2322

2423
"github.com/arduino/go-paths-helper"
@@ -69,8 +68,7 @@ func (s *Systray) Restart() {
6968
}
7069

7170
// Launch executable
72-
cmd := exec.Command(s.path, args...)
73-
err := cmd.Start()
71+
err := execApp(s.path, args...)
7472
if err != nil {
7573
log.Printf("Error restarting process: %v\n", err)
7674
return

0 commit comments

Comments
 (0)