mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 05:37:44 +00:00
* Fix hass script execution on Windows (#4977). hass.exe returned ERRNO2 on a windows machine and must be started using package loading. This fix adapts the command line options for `setup_and_run_hass()` to start either a script with `python homeassistant/__main__.py` or with `Scripts/hass.exe` * Fix code style
This commit is contained in:
parent
30d4c54187
commit
f5d8327d9a
@ -255,10 +255,13 @@ def closefds_osx(min_fd: int, max_fd: int) -> None:
|
||||
|
||||
def cmdline() -> List[str]:
|
||||
"""Collect path and arguments to re-execute the current hass instance."""
|
||||
if sys.argv[0].endswith('/__main__.py'):
|
||||
if sys.argv[0].endswith(os.path.sep + '__main__.py'):
|
||||
modulepath = os.path.dirname(sys.argv[0])
|
||||
os.environ['PYTHONPATH'] = os.path.dirname(modulepath)
|
||||
return [sys.executable] + [arg for arg in sys.argv if arg != '--daemon']
|
||||
return [sys.executable] + [arg for arg in sys.argv if
|
||||
arg != '--daemon']
|
||||
else:
|
||||
return [arg for arg in sys.argv if arg != '--daemon']
|
||||
|
||||
|
||||
def setup_and_run_hass(config_dir: str,
|
||||
|
Loading…
x
Reference in New Issue
Block a user