Skip to content

Commit

Permalink
added support for delve
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates committed Jul 19, 2017
1 parent 7b67b41 commit ea691f3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
26 changes: 14 additions & 12 deletions refresh/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,22 @@ func (r *Manager) Start() error {
w := NewWatcher(r)
w.Start()
go r.build(fsnotify.Event{Name: ":start:"})
go func() {
for {
select {
case event := <-w.Events:
if event.Op != fsnotify.Chmod {
go r.build(event)
if !r.Debug {
go func() {
for {
select {
case event := <-w.Events:
if event.Op != fsnotify.Chmod {
go r.build(event)
}
w.Remove(event.Name)
w.Add(event.Name)
case <-r.context.Done():
break
}
w.Remove(event.Name)
w.Add(event.Name)
case <-r.context.Done():
break
}
}
}()
}()
}
go func() {
for {
select {
Expand Down
9 changes: 8 additions & 1 deletion refresh/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ func (m *Manager) runner() {
m.Logger.Success("Stopping: PID %d", pid)
cmd.Process.Kill()
}
cmd = exec.Command(m.FullBuildPath(), m.CommandFlags...)
if m.Debug {
bp := m.FullBuildPath()
args := []string{"exec", bp}
args = append(args, m.CommandFlags...)
cmd = exec.Command("dlv", args...)
} else {
cmd = exec.Command(m.FullBuildPath(), m.CommandFlags...)
}
go func() {
err := m.runAndListen(cmd)
if err != nil {
Expand Down

0 comments on commit ea691f3

Please sign in to comment.