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

Add support for Windows #1

Merged
merged 2 commits into from
Feb 21, 2024
Merged

Add support for Windows #1

merged 2 commits into from
Feb 21, 2024

Conversation

fritzmg
Copy link
Contributor

@fritzmg fritzmg commented Feb 20, 2024

This PR adds support for Windows by using tasklist /FI "PID eq …". Since this executable will always exit with code 0 we instead have to inspect its output. Symfony Process will start any processes under Windows as a cmd.exe subprocess. As such tasklist /FI "PID eq …" will then have an output like this for the given process ID (with an English locale):

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
cmd.exe                      15048 Console                    5      5

In case the PID is not found, the output will look like this:

INFO: No tasks are running which match the specified criteria.

Thus this PR assumes that as long as cmd.exe is in the output, the process with the given process ID is still actually running.

@Toflar
Copy link
Owner

Toflar commented Feb 21, 2024

I guess we should integrate this also into our tests and run those on windows only (and the current ones on linux only). I've just pushed the foundation for Github tests to develop. Can you rebase and maybe integrate the logic in the tests?

@fritzmg
Copy link
Contributor Author

fritzmg commented Feb 21, 2024

Hm, right now I can't come up with a way to adjust countSleepProcesses() for Windows though 🤔

@fritzmg
Copy link
Contributor Author

fritzmg commented Feb 21, 2024

I mean the test would work, if you run it in a cygwin or mingw command line under Windows - is that something you can set up? Then this could be merged as is.

@Toflar
Copy link
Owner

Toflar commented Feb 21, 2024

My goal would be to add another job in the workflows with runs-on: windows-latest. Does tasklist not contain all the sleep commands?

@fritzmg
Copy link
Contributor Author

fritzmg commented Feb 21, 2024

No, Symfony Process starts every process via cmd.exe - so tasklist will only see cmd.exe and nothing else (and you cannot inspect command arguments with tasklist).

@Toflar
Copy link
Owner

Toflar commented Feb 21, 2024

Maybe in conjunction with https://github.com/marketplace/actions/install-cygwin then? I'm not familiar with it at all so I don't think I can set this up^^

@fritzmg
Copy link
Contributor Author

fritzmg commented Feb 21, 2024

Besides, the runner.php will also only work on Unix and cygwin/mingw environments, as there is no sleep command under Windows.

@fritzmg
Copy link
Contributor Author

fritzmg commented Feb 21, 2024

Maybe in conjunction with https://github.com/marketplace/actions/install-cygwin then? I'm not familiar with it at all so I don't think I can set this up^^

Me neither, but we can try ;)

@Toflar Toflar merged commit 53867a5 into Toflar:develop Feb 21, 2024
4 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants