tools (common/async_process): accept Path instances as command path.
This commit is contained in:
parent
0c785f0934
commit
17ae6ba241
1 changed files with 3 additions and 0 deletions
|
|
@ -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 @@ class CommandProtocol(protocol.ProcessProtocol):
|
|||
"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
|
||||
|
|
|
|||
Loading…
Reference in a new issue