Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error editing config #165

Open
pixx1 opened this issue Sep 5, 2019 · 8 comments
Open

error editing config #165

pixx1 opened this issue Sep 5, 2019 · 8 comments
Labels
bug Something isn't working docker-image Docker image

Comments

@pixx1
Copy link

pixx1 commented Sep 5, 2019

Hi there!
First, thanks for the nice tool!

I run into the issue when I tried to change the configure.
By pressing "o" i get the error

"exec: "sh": executable file not found in $PATH

Did i missed something? I'm using lazydocker in a docker.

System:
lazyteam/lazydocker:latest
ubuntu 18.04
docker: Docker version 19.03.2, build 6a30dfc

Thanks!
pix_1

EDIT:
This not happen when using the binary version.

@dawidd6 dawidd6 added bug Something isn't working and removed discussion labels Sep 5, 2019
@dawidd6
Copy link
Collaborator

dawidd6 commented Sep 5, 2019

@qdm12 any ideas on that?

@dawidd6 dawidd6 added the docker-image Docker image label Sep 5, 2019
@qdm12
Copy link
Contributor

qdm12 commented Sep 5, 2019

It's because the binary is on a Scratch image so there is no shell. What program does lazydocker use to modify the configure? Maybe we can incorporate it in Go? Otherwise we can have the go binary on Alpine which should solve the problem but it's less fancy.

@dawidd6
Copy link
Collaborator

dawidd6 commented Sep 5, 2019

// OpenFile opens a file with the given
func (c *OSCommand) OpenFile(filename string) 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
}
// OpenLink opens a file with the given
func (c *OSCommand) OpenLink(link string) error {
commandTemplate := c.Config.UserConfig.OS.OpenLinkCommand
templateValues := map[string]string{
"link": c.Quote(link),
}
command := utils.ResolvePlaceholderString(commandTemplate, templateValues)
err := c.RunCommand(command)
return err
}
// EditFile opens a file in a subprocess using whatever editor is available,
// falling back to core.editor, VISUAL, EDITOR, then vi
func (c *OSCommand) EditFile(filename string) (*exec.Cmd, error) {
editor := c.getenv("VISUAL")
if editor == "" {
editor = c.getenv("EDITOR")
}
if editor == "" {
if err := c.RunCommand("which vi"); err == nil {
editor = "vi"
}
}
if editor == "" {
return nil, errors.New("No editor defined in $VISUAL or $EDITOR")
}
return c.PrepareSubProcess(editor, filename), nil
}

c.Config.UserConfig.OS.OpenCommand defaults to xdg-open on linux.

@qdm12
Copy link
Contributor

qdm12 commented Sep 5, 2019

Maybe put a statically built xdg-open binary next to lazydocker in the scratch image? I'm away from keyboard but I'll check later.

EDIT: I'm looking into it now, I might have an ugly solution to copy paste xdg-open from an Alpine image to /bin.

@qdm12
Copy link
Contributor

qdm12 commented Sep 11, 2019

When you try to edit the configuration with e, it also fails with this error. I will try to add a static build of vi to see if it works out.

Concerning o to open the config file, I end up here but I'm not sure where to look now, some help would be appreciated 😄

Should we simply let the user modify the config by bind mounting it on the Docker host?

@jesseduffield
Copy link
Owner

jesseduffield commented Sep 14, 2019

@qdm12 I think bind mounting is a good solution.

As for your question about the OpenFile config option, happy to give guidance but I'm not sure what you're looking for haha

@meteoro
Copy link

meteoro commented Nov 1, 2023

Open in nano or vim?

@mark2185
Copy link
Contributor

mark2185 commented Nov 1, 2023

@meteoro could you please clarify what is the question?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docker-image Docker image
Projects
None yet
Development

No branches or pull requests

6 participants