diff --git a/libervia/backend/tools/common/async_process.py b/libervia/backend/tools/common/async_process.py index f30d2e13..80e0ae31 100644 --- a/libervia/backend/tools/common/async_process.py +++ b/libervia/backend/tools/common/async_process.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 -# SAT: a jabber client -# Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org) +# Libervia XMPP client +# Copyright (C) 2009-2026 Jérôme Poisson (goffi@goffi.org) # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -34,12 +34,12 @@ log = getLogger(__name__) class CommandProtocol(protocol.ProcessProtocol): """handle an external command""" - # name of the command (unicode) - name = None - # full path to the command (bytes) - command = None - # True to activate logging of command outputs (bool) - log = False + # name of the command + name: str|None = None + # full path to the command + command: bytes|None = None + # True to activate logging of command outputs + log: bool = False def __init__(self, deferred, stdin=None): """ @@ -130,7 +130,8 @@ class CommandProtocol(protocol.ProcessProtocol): """ stdin = kwargs.pop("stdin", None) if stdin is not None: - stdin = stdin.encode("utf-8") + if isinstance(stdin, str): + stdin = stdin.encode() verbose = kwargs.pop("verbose", False) args = list(args) d = defer.Deferred()