Rather than doing this, how about calling `serverstop.sh` / `serverstop.bat` ?  Then this code can be generic (using the `platforms` package for getting the right script), will work for Windows, and will keep OS-specific code in a single place.