Skip to content
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
13 changes: 7 additions & 6 deletions realize/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ func (w *filePoller) Add(name string) error {
return errPollerClosed
}


if w.watches == nil {
w.watches = make(map[string]chan struct{})
} else if _, exists := w.watches[name]; exists {
return fmt.Errorf("watch exists")
}

f, err := os.Open(name)
if err != nil {
return err
Expand All @@ -146,12 +153,6 @@ func (w *filePoller) Add(name string) error {
return err
}

if w.watches == nil {
w.watches = make(map[string]chan struct{})
}
if _, exists := w.watches[name]; exists {
return fmt.Errorf("watch exists")
}
chClose := make(chan struct{})
w.watches[name] = chClose
go w.watch(f, fi, chClose)
Expand Down
17 changes: 16 additions & 1 deletion realize/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,25 @@ func (p *Project) stamp(t string, o BufferOut, msg string, stream string) {
}()
}

// buildEnvs returns a copy of strings representing the environment,
// in the form "key=value".
func (p Project) buildEnvs() (envs []string) {
envMap := make(map[string]string)

for _, env := range os.Environ() {
e := strings.SplitN(env, "=", 2)

envMap[e[0]] = e[1]
}

for k, v := range p.Env {
envs = append(envs, fmt.Sprintf("%s=%s", strings.Replace(k, "=", "", -1), v))
envMap[strings.Replace(k, "=", "", -1)] = v
}

for k, v := range envMap {
envs = append(envs, fmt.Sprintf("%s=%s", k, v))
}

return
}

Expand Down