Eptagone / Vite.AspNetCore

Small library to integrate Vite into ASP.NET projects
MIT License
264 stars 35 forks source link

Remove powershell scripting dependency windows #93

Closed astrassburg closed 8 months ago

astrassburg commented 9 months ago

This PR removes the Powershell.exe dependency for Windows platforms as well as the spawned script to poll and kill the Vite process. Some organizations block Powershell, and this change seems like it could benefit the community of users by reducing some complexity and giving the child process management back to the OS.

The new ChildProcessTracker class registers a Job object (https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects) to allow the spawned Vite process to be terminated when the application terminates regardless of the manner of termination.

Tested on:

Windows 10 Ubuntu 22.04

The Ubuntu testing was just to ensure the platform-specific calls didn't cause build or runtime problems on other platforms.

Eptagone commented 9 months ago

Well, it seems to work well for me. I just have one question. Is it possible to make the new classes private or internal? I don't think it's necessary for them to be accessible outside the library.

astrassburg commented 9 months ago

Sure, I made the change. While classes in a namespace can't be explicitly marked private or internal, removing the public modifier does what we want.