-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix redirecting WslLaunch's output to a file #29
Conversation
43ed6b2
to
b4ca1dc
Compare
aa3d4a6
to
a047622
Compare
d4ff898
to
a047622
Compare
76843be
to
d7b4048
Compare
88c4358
to
56bf249
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can’t say I grocked every single details, but here is my general feedbacks. My main concern is the last comment (about returning nil if the command was running on WSL side, but failed). I know we discussed it but rereading it and seeing it back in tests, I’m less sure nowdays this is the right call.
ffb01de
to
b602a90
Compare
Forced pushed to rebase to main. Also used the oportunity to strategically squash commits so that they make sense once this branch is merged to main. |
f064c32
to
9a90d52
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still some discussions needed, but getting there!
3b1459c
to
65f8ee0
Compare
The WSL API doesn't allow writing to a file directly without an intermediate pipe. Since pipes are also represented as an *os.File, we have no way of distinguishing the two to treat them differently. These tests demonstrate this failure, although they are skipped for now until a fix is found.
The main implication is that we offload responsabilities to the stdlib: - We can use os.Process utils instead of our own implementation - We can use exec.ExitError An adjacent change: since wsl.ExitError no longer exists, (*distro).Shell had to be rethought when it comes to its return values. I decided to create a ShellError that contains the exit code.
Stdout and Stderr pipes were being read from before the process finished, so they were sometimes empty.
We know that the WSL API doesn't allow writing to a file directly without an intermediate pipe. Since pipes are also represented as an *os.File, we have to distinguish the two with the Win32 API. This fixes this problem and removes the Skip in the tests
Sometimes WSL takes a while to boot up, making some timeouts trigger for even the simplest commands. Keeping the test distro alive during the test should prevent this.
Seems like the Azure machine is quite slow.
65f8ee0
to
8b54b41
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, 2 remaining ones and we are done for good with this branch IMHO!
It makes for easier debugging
Passing a real file descriptor to WslLaunch does not write to a file for some reason, so I have to stick an intermediate pipe in there. This pull request does two things that should have probably been two separate PR, but became too intertwined:
Brought (*distro).Cmd closer to the standard library for more details.
WSL-401