Mercurial > libervia-backend
changeset 4273:9308b2d15fd2
tools (common/async_process): accept `Path` instances as command path.
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 20 Jun 2024 14:47:09 +0200 |
parents | 89a0999884ac |
children | 2992f9d1e039 |
files | libervia/backend/tools/common/async_process.py |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libervia/backend/tools/common/async_process.py Thu Jun 20 14:46:55 2024 +0200 +++ b/libervia/backend/tools/common/async_process.py Thu Jun 20 14:47:09 2024 +0200 @@ -20,6 +20,7 @@ """tools to launch process in a async way (using Twisted)""" import os.path +from pathlib import Path from typing import Any from twisted.internet import defer, reactor, protocol from twisted.python.failure import Failure @@ -143,6 +144,8 @@ "to execute as first argument" ) command = args.pop(0) + if isinstance(command, Path): + command = str(command) if prot.name is None: name = os.path.splitext(os.path.basename(command))[0] prot.name = name