saltstack/salt — pull request #16996 by ryepup (2014-10-29 15:22:59+00:00)
Title: Win service stop reliably

`net stop` is not a reliable means to stop a service. It issues a stop command, waits briefly, then exits with rc 0 regardless of whether the service is stopped or not.

These patches add a polling loop using `win_service.status` to wait until the service is actually stopped. This appears to be the common approach used by windows admins in batch/vbs scripts.

See commit messages for more details and links to relevant stackoverflow articles.