-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Refactor win_system.py #25992
Refactor win_system.py #25992
Conversation
Support for reboot, shutdown, etc | ||
''' | ||
from __future__ import absolute_import | ||
|
||
# Import python libs | ||
import logging | ||
import re | ||
import datetime | ||
from ctypes import windll |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be gated and will cause import errors on non-Windows sytems.
Hi @twangboy. This has some lint errors and an import which needs to be gated for cross-platorm compatability. Please let me know when you've got those issues fixed up and we'll get this merged. Thanks. |
update win_system exec mod unit tests
@twangboy, I have a question about this pr. I noticed that you used
instead of using
in your code. I was wondering why you did this. This is because I want to make a PR that affects this file and will use other function from the reg module and I want to understand this. If anyone else can answer that question I would be grateful. |
@hrumph Perhaps because I didn't know what I was doing. Feel free to use |
Thanks @twangboy. I thought that there might be some esoteric reason that I'd never be able to figure out without someone telling me first. |
Fixes: #12255
The problem was dumping unicode from python to the windows terminal when shelling out using cmd.run. The unicode didn't translate very well from python to the windows code page.
Removed all code that was shelling out.
Transitioned to pywin32 as much as possible.
Used ctype libraries for those unavailable in pywin32.
Improved documentation.
Added shutdown_abort, lock, and unjoin_domain functions.
Added set_system_date_time which is used by set_system_date and set_system_time