mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
Launch OpenFile command in sub process
This commit is contained in:
parent
1ff2198c0a
commit
e435636760
2 changed files with 5 additions and 8 deletions
|
|
@ -128,15 +128,14 @@ func sanitisedCommandOutput(output []byte, err error) (string, error) {
|
|||
}
|
||||
|
||||
// OpenFile opens a file with the given
|
||||
func (c *OSCommand) OpenFile(filename string) error {
|
||||
func (c *OSCommand) OpenFile(filename string) (*exec.Cmd, error) {
|
||||
commandTemplate := c.Config.UserConfig.OS.OpenCommand
|
||||
templateValues := map[string]string{
|
||||
"filename": c.Quote(filename),
|
||||
}
|
||||
|
||||
command := utils.ResolvePlaceholderString(commandTemplate, templateValues)
|
||||
err := c.RunCommand(command)
|
||||
return err
|
||||
command := c.ExecutableFromString(utils.ResolvePlaceholderString(commandTemplate, templateValues))
|
||||
return command, nil
|
||||
}
|
||||
|
||||
// OpenLink opens a file with the given
|
||||
|
|
|
|||
|
|
@ -345,10 +345,8 @@ func (gui *Gui) editFile(filename string) error {
|
|||
}
|
||||
|
||||
func (gui *Gui) openFile(filename string) error {
|
||||
if err := gui.OSCommand.OpenFile(filename); err != nil {
|
||||
return gui.createErrorPanel(gui.g, err.Error())
|
||||
}
|
||||
return nil
|
||||
_, err := gui.runSyncOrAsyncCommand(gui.OSCommand.OpenFile(filename))
|
||||
return err
|
||||
}
|
||||
|
||||
// runSyncOrAsyncCommand takes the output of a command that may have returned
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue