Skip to content

Commit

Permalink
modified: daemon.go
Browse files Browse the repository at this point in the history
  • Loading branch information
nbari committed Aug 2, 2016
1 parent c99d073 commit 7807613
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions daemon.go
Expand Up @@ -149,20 +149,22 @@ func New(cfg *Config) (*Daemon, error) {

// if ctrl create supervise dir
if cfg.ctrl {
// create fifo
var ctrl = []string{"control", "ok"}
for _, v := range ctrl {
if err := MakeFifo(filepath.Join(supDir, v)); err != nil {
return nil, err
}
}

// lock
if lock, err := os.Create(filepath.Join(supDir, "lock")); err != nil {
return nil, err
} else if err = syscall.Flock(int(lock.Fd()), syscall.LOCK_EX+syscall.LOCK_NB); err != nil {
return nil, err
}

// fifo
var ctrl = []string{"control", "ok"}
for _, v := range ctrl {
if err := MakeFifo(filepath.Join(supDir, v)); err != nil {
return nil, err
}
}
// read fifo
if control.fifo_control, err = OpenFifo(filepath.Join(supDir, "control")); err != nil {
return nil, err
}
Expand Down

0 comments on commit 7807613

Please sign in to comment.