diff options
author | Thomas Voss <mail@thomasvoss.com> | 2025-06-13 23:35:04 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2025-06-13 23:35:04 +0200 |
commit | 294cb6062a0d3b0e38cc354152e14205638e65f6 (patch) | |
tree | 4d5c45a3c660ccc6e6eec89eb2f19a1946e3226d | |
parent | 53b23a865a209851d7360dac6962fa44c1aeed06 (diff) |
Make more use of Try/Try2
-rw-r--r-- | main.go | 22 |
1 files changed, 4 insertions, 18 deletions
@@ -48,29 +48,15 @@ func main() { } func watch() { - path, err := os.Executable() - if err != nil { - log.Fatal(err) - } - - ostat, err := os.Stat(path) - if err != nil { - log.Fatal(err) - } + path := Try2(os.Executable()) + ostat := Try2(os.Stat(path)) for { - nstat, err := os.Stat(path) - if err != nil { - log.Fatal(err) - } - + nstat := Try2(os.Stat(path)) if nstat.ModTime() != ostat.ModTime() { dbx.Close() - if err := syscall.Exec(path, os.Args, os.Environ()); err != nil { - log.Fatal(err) - } + Try(syscall.Exec(path, os.Args, os.Environ())) } - time.Sleep(1 * time.Second) } } |