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

Fix Windows build and build on Windows CI #74

Merged
merged 5 commits into from
Jun 18, 2024
Merged

Fix Windows build and build on Windows CI #74

merged 5 commits into from
Jun 18, 2024

Conversation

chicoxyzzy
Copy link
Contributor

@chicoxyzzy chicoxyzzy commented Jun 6, 2024

We should use something platform-independent instead of printenv. I'm going to work on this in another PR

@chicoxyzzy chicoxyzzy self-assigned this Jun 6, 2024
@chicoxyzzy chicoxyzzy added the tests test coverage label Jun 6, 2024
@Tyl13
Copy link
Contributor

Tyl13 commented Jun 10, 2024

Could a way of checking the environment variables independently of the operating system be by introducing either a flag or command to return the environment variables that the CLI has access to?

This means you don't have to worry about if Microsoft changes their commands, and guarantees that the environment variables returned are the same ones that the command actually has access to. A flag would allow it to be used with any of the commands so that you can still test the run command.

@chicoxyzzy chicoxyzzy force-pushed the run_tests_win branch 2 times, most recently from 04eaa08 to 44227e0 Compare June 18, 2024 20:22
@chicoxyzzy
Copy link
Contributor Author

chicoxyzzy commented Jun 18, 2024

Could a way of checking the environment variables independently of the operating system be by introducing either a flag or command to return the environment variables that the CLI has access to?

This means you don't have to worry about if Microsoft changes their commands, and guarantees that the environment variables returned are the same ones that the command actually has access to. A flag would allow it to be used with any of the commands so that you can still test the run command.

Yes, I was thinking about that. For now I'm going to disable these tests on Windows and work on enabling them in a next PR

@chicoxyzzy chicoxyzzy changed the title Fix dispatch run tests on Windows Build on Windows CI Jun 18, 2024
@chicoxyzzy chicoxyzzy force-pushed the run_tests_win branch 7 times, most recently from 785a75a to ad0f067 Compare June 18, 2024 21:31
Copy link
Contributor

@achille-roussel achille-roussel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@chicoxyzzy
Copy link
Contributor Author

chicoxyzzy commented Jun 18, 2024

@chriso please let me know if I should do something to kill all the processes on Windows similar to how it's done for linux and darwin.

@achille-roussel not sure how to use run_unix.go, it says

killProcess redeclared in this block (see details) [windows]

...so I reuse the same code in run_linux.go and run_darwin.go here

@chicoxyzzy chicoxyzzy marked this pull request as ready for review June 18, 2024 21:40
@chicoxyzzy chicoxyzzy changed the title Build on Windows CI Fix Windows build and build on Windows CI Jun 18, 2024
@chriso
Copy link
Contributor

chriso commented Jun 18, 2024

The reason we use the lower level syscall.Kill for Linux/macOS is because it lets us pass a negative PID, which sends the signals to all processes in the process group we create (via SysProcAttr.Setpgid) when spawning the local application.

The higher level cmd.Process.Kill() is equivalent to syscall.Kill(cmd.Process.Pid, syscall.SIGKILL) on these platforms, which sends the signal to the process rather than the process group.

I'm not familiar with Windows syscalls so I'm not sure how to accomplish the same thing there. Windows may not even have the concept of process groups. I think what you've done here – default to using cmd.Process.Kill() – is the right approach for now 👍 We can figure out a better strategy for Windows later if/when necessary.

@chicoxyzzy chicoxyzzy merged commit 5ba89d3 into main Jun 18, 2024
3 checks passed
@chicoxyzzy chicoxyzzy deleted the run_tests_win branch June 18, 2024 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests test coverage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants