2020-10-29 07:50:25 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2020-10-29 15:52:31 +01:00
|
|
|
"context"
|
2020-10-29 07:50:25 +01:00
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"os/exec"
|
|
|
|
"strconv"
|
|
|
|
|
|
|
|
"github.com/webview/webview"
|
|
|
|
)
|
|
|
|
|
2020-10-29 15:52:31 +01:00
|
|
|
func runOctoTasks(ctx context.Context) {
|
2020-12-04 11:28:35 +01:00
|
|
|
cmd := exec.CommandContext(ctx, "./octoserver", "--monitorpid", strconv.FormatInt(int64(os.Getpid()), 10), "--single-user")
|
2020-10-29 07:50:25 +01:00
|
|
|
cmd.Stdout = os.Stdout
|
|
|
|
err := cmd.Run()
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
log.Printf("Just ran subprocess %d, exiting\n", cmd.Process.Pid)
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
debug := true
|
|
|
|
w := webview.New(debug)
|
|
|
|
defer w.Destroy()
|
2020-10-29 15:52:31 +01:00
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
go runOctoTasks(ctx)
|
2020-10-29 07:50:25 +01:00
|
|
|
|
|
|
|
w.SetTitle("Octo Tasks")
|
|
|
|
w.SetSize(1024, 768, webview.HintNone)
|
|
|
|
w.Navigate("http://localhost:8000")
|
|
|
|
w.Run()
|
2020-10-29 15:52:31 +01:00
|
|
|
cancel()
|
2020-10-29 07:50:25 +01:00
|
|
|
}
|