Skip to content

Commit bd2e0e1

Browse files
committed
Merge pull request #94 from arduino/restart
Find path before updating
2 parents 108f7d2 + 508a0fc commit bd2e0e1

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

update.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ import (
3636
)
3737

3838
func updateHandler(c *gin.Context) {
39+
40+
path, err := osext.Executable()
41+
42+
if err != nil {
43+
c.JSON(500, gin.H{"error": err.Error()})
44+
return
45+
}
46+
3947
var up = &updater.Updater{
4048
CurrentVersion: version,
4149
APIURL: *updateUrl,
@@ -45,14 +53,7 @@ func updateHandler(c *gin.Context) {
4553
CmdName: *appName,
4654
}
4755

48-
err := up.BackgroundRun()
49-
50-
if err != nil {
51-
c.JSON(500, gin.H{"error": err.Error()})
52-
return
53-
}
54-
55-
path, err := osext.Executable()
56+
err = up.BackgroundRun()
5657

5758
if err != nil {
5859
c.JSON(500, gin.H{"error": err.Error()})

0 commit comments

Comments
 (0)