Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
fix daemon flag transmit error
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed Oct 17, 2017
1 parent 8e6b4cd commit 1fc367d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
#

go generate
GOOS=linux GOARCH=arm go build -tags vfs
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,10 @@ func ServeHTTP(port int) error {

func runDaemon() {
environ := os.Environ()
environ = append(environ, "IGNORE_SIGHUP=true")
cmd := kexec.Command(os.Args[0], "-p", strconv.Itoa(listenPort))
// env:IGNORE_SIGHUP forward stdout and stderr to file
// env:ATX_AGENT will ignore -d flag
environ = append(environ, "IGNORE_SIGHUP=true", "ATX_AGENT=1")
cmd := kexec.Command(os.Args[0], os.Args[1:]...)
cmd.Env = environ
cmd.Start()
select {
Expand Down Expand Up @@ -625,7 +627,7 @@ func main() {
log.Println("requirements not ready:", err)
}

if *fDaemon {
if *fDaemon && os.Getenv("ATX_AGENT") == "" {
runDaemon()
return
}
Expand Down

0 comments on commit 1fc367d

Please sign in to comment.