pty icon indicating copy to clipboard operation
pty copied to clipboard

Windows subsystem as normal user errors on all commands.

Open mjarkk opened this issue 5 years ago • 3 comments

Currently i'm trying to solve this issue: https://github.com/jesseduffield/lazygit/issues/360

The short version of this issue is that when we use this package to run Git commands it errors on the Windows linux based subsystem as normal user with this error:
fork/exec /usr/bin/git: invalid arguments

Here is the code we use to do a git pull:

	cmd := exec.Command("git", "pull")

	cmd.Env = os.Environ()
	cmd.Env = append(cmd.Env, "LANG=en_US.UTF-8", "LC_ALL=en_US.UTF-8")

	var stderr bytes.Buffer
	cmd.Stderr = &stderr

	ptmx, err := pty.Start(cmd)

	if err != nil {
		return err // IT ERRORS HERE
	}

	// Other code

Do you know what the problem is here?
From other Github issues about the windows subsystem I've noticed that this might be related to the windows subsystem kernel.
Although there is one wired thing.. If the binary gets ran as root it works completely fine.

Do you have any idea why this happens or what might cause this.

Here are some other details:

  • OS: Windows subsystem Debian based
  • When running the commands with bash -c "git pull" also gives the same error (sh does the same thing)
  • When running as root it works fine
  • git fetch, pull, push all work perfectly fine when ran in the normal shell and without this package.
  • We use a fork of your package that is up to date with yours but with a different way of error reporting, here are the changes: https://github.com/jesseduffield/pty/commit/02db52c7e406c7abec44c717a173c7715e4c1b62
  • This happens on all subsystems: Debian, OpenSuse, Ubuntu, etc

mjarkk avatar Jan 25 '19 10:01 mjarkk

Update this happens not only with git it happens with everything, i tried ls -a and it gave the same error:
fork/exec /usr/bin/ls: invalid arguments

mjarkk avatar Jan 25 '19 11:01 mjarkk

It would seem as of Windows 10 version 1903, this is no longer an issue. From what I understand build 18305 has fixed it.

LouisT avatar Jun 06 '19 06:06 LouisT

Great, i'll try it out again when i have access to a windows PC.
It it works i'll close the issue.

mjarkk avatar Jun 06 '19 11:06 mjarkk