A lightweight mechanism to provide an *instant kickstart* to a Go web server instance upon changing any Go source files under the project directory (and its subdirectories).

startstop_windows.go 574B

12345678910111213141516171819202122232425262728
  1. // The Isomorphic Go Project
  2. // Copyright (c) Wirecog, LLC. All rights reserved.
  3. // Use of this source code is governed by a BSD-style
  4. // license, which can be found in the LICENSE file.
  5. // +build windows
  6. package main
  7. import (
  8. "os"
  9. "os/exec"
  10. "strconv"
  11. )
  12. func start() *exec.Cmd {
  13. buildGopherJSProject()
  14. cmd := exec.Command("go", "run", appPath+"/"+mainSourceFile)
  15. cmd.Stdout = os.Stdout
  16. cmd.Stderr = os.Stderr
  17. cmd.Start()
  18. return cmd
  19. }
  20. func stop(cmd *exec.Cmd) {
  21. stop := exec.Command("TASKKILL", "/T", "/F", "/PID", strconv.Itoa(cmd.Process.Pid))
  22. stop.Run()
  23. }