mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
fix: prevent freeze when opening config with 'o' key
Use non-blocking cmd.Start() with goroutine for Wait() instead of synchronous RunCommand() in OpenFile and OpenLink methods. Fixes jesseduffield/lazydocker#688
This commit is contained in:
parent
577797d9ed
commit
38721df853
1 changed files with 12 additions and 4 deletions
|
|
@ -161,8 +161,12 @@ func (c *OSCommand) OpenFile(filename string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
command := utils.ResolvePlaceholderString(commandTemplate, templateValues)
|
command := utils.ResolvePlaceholderString(commandTemplate, templateValues)
|
||||||
err := c.RunCommand(command)
|
cmd := c.ExecutableFromString(command)
|
||||||
return err
|
if err := cmd.Start(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
go cmd.Wait()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// OpenLink opens a file with the given
|
// OpenLink opens a file with the given
|
||||||
|
|
@ -173,8 +177,12 @@ func (c *OSCommand) OpenLink(link string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
command := utils.ResolvePlaceholderString(commandTemplate, templateValues)
|
command := utils.ResolvePlaceholderString(commandTemplate, templateValues)
|
||||||
err := c.RunCommand(command)
|
cmd := c.ExecutableFromString(command)
|
||||||
return err
|
if err := cmd.Start(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
go cmd.Wait()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// EditFile opens a file in a subprocess using whatever editor is available,
|
// EditFile opens a file in a subprocess using whatever editor is available,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue