Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger rebuild on SIGTSTP #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ package main
import (
"flag"
"fmt"
"github.com/pilu/fresh/runner"
"os"

"github.com/pilu/fresh/runner"
)

func main() {
Expand Down
23 changes: 23 additions & 0 deletions runner/listener.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package runner

import (
"fmt"
"os"
"os/signal"
"syscall"
)

func listen() {
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTSTP)

go func() {
for range c {
fmt.Println("")
listenerLog("Force rebuild")
startChannel <- "force"
}
}()

listenerLog("Listening ctrl+Z")
}
31 changes: 16 additions & 15 deletions runner/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@ const (
)

var settings = map[string]string{
"config_path": "./runner.conf",
"root": ".",
"tmp_path": "./tmp",
"build_name": "runner-build",
"build_log": "runner-build-errors.log",
"valid_ext": ".go, .tpl, .tmpl, .html",
"no_rebuild_ext": ".tpl, .tmpl, .html",
"ignored": "assets, tmp",
"build_delay": "600",
"colors": "1",
"log_color_main": "cyan",
"log_color_build": "yellow",
"log_color_runner": "green",
"log_color_watcher": "magenta",
"log_color_app": "",
"config_path": "./runner.conf",
"root": ".",
"tmp_path": "./tmp",
"build_name": "runner-build",
"build_log": "runner-build-errors.log",
"valid_ext": ".go, .tpl, .tmpl, .html",
"no_rebuild_ext": ".tpl, .tmpl, .html",
"ignored": "assets, tmp",
"build_delay": "600",
"colors": "1",
"log_color_main": "cyan",
"log_color_build": "yellow",
"log_color_runner": "green",
"log_color_watcher": "magenta",
"log_color_listener": "blue",
"log_color_app": "",
}

var colors = map[string]string{
Expand Down
3 changes: 3 additions & 0 deletions runner/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var (
stopChannel chan bool
mainLog logFunc
watcherLog logFunc
listenerLog logFunc
runnerLog logFunc
buildLog logFunc
appLog logFunc
Expand Down Expand Up @@ -88,6 +89,7 @@ func init() {
func initLogFuncs() {
mainLog = newLogFunc("main")
watcherLog = newLogFunc("watcher")
listenerLog = newLogFunc("listener")
runnerLog = newLogFunc("runner")
buildLog = newLogFunc("build")
appLog = newLogFunc("app")
Expand Down Expand Up @@ -115,6 +117,7 @@ func Start() {
initFolders()
setEnvVars()
watch()
listen()
start()
startChannel <- "/"

Expand Down