Fixed issues with telemetry.
This commit is contained in:
@@ -36,6 +36,7 @@ from .viewmodels.dashboard import (
|
||||
game_client_activity_text,
|
||||
interrupt_game_supervisor,
|
||||
launcher_child_command,
|
||||
launcher_child_environment,
|
||||
launcher_restart_spec,
|
||||
launcher_update_presentation,
|
||||
news_card_columns,
|
||||
@@ -131,6 +132,7 @@ __all__ = [
|
||||
"interrupt_game_supervisor",
|
||||
"launch_external_url",
|
||||
"launcher_child_command",
|
||||
"launcher_child_environment",
|
||||
"launcher_restart_spec",
|
||||
"launcher_update_presentation",
|
||||
"news_card_columns",
|
||||
|
||||
@@ -123,6 +123,7 @@ from .viewmodels.dashboard import (
|
||||
game_client_activity_text,
|
||||
interrupt_game_supervisor,
|
||||
launcher_child_command,
|
||||
launcher_child_environment,
|
||||
launcher_restart_spec,
|
||||
launcher_update_presentation,
|
||||
news_card_columns,
|
||||
@@ -1064,7 +1065,8 @@ def run_dashboard(paths: AppPaths) -> None:
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
bufsize=1,
|
||||
)
|
||||
env=launcher_child_environment(),
|
||||
)
|
||||
except OSError as process_error:
|
||||
publish_output(f"Could not start operation: {process_error}\n")
|
||||
if game_client_id is None:
|
||||
|
||||
@@ -14,6 +14,10 @@ from typing import TYPE_CHECKING, Callable, Mapping
|
||||
|
||||
from ...paths import AppPaths
|
||||
from ...self_update import LauncherUpdateCheck
|
||||
from ...telemetry import (
|
||||
TELEMETRY_OPERATION_PROCESS_ROLE,
|
||||
TELEMETRY_PROCESS_ROLE_VARIABLE,
|
||||
)
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -465,6 +469,18 @@ def launcher_child_command(*arguments: str) -> list[str]:
|
||||
return [sys.executable, "-B", "-m", "ptlinux", *arguments]
|
||||
|
||||
|
||||
def launcher_child_environment(
|
||||
environment: Mapping[str, str] | None = None,
|
||||
) -> dict[str, str]:
|
||||
"""Mark an internal CLI process as part of the current dashboard session."""
|
||||
|
||||
child_environment = dict(os.environ if environment is None else environment)
|
||||
child_environment[TELEMETRY_PROCESS_ROLE_VARIABLE] = (
|
||||
TELEMETRY_OPERATION_PROCESS_ROLE
|
||||
)
|
||||
return child_environment
|
||||
|
||||
|
||||
def dashboard_poll_interval(
|
||||
*,
|
||||
operation_active: bool,
|
||||
|
||||
Reference in New Issue
Block a user