mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Add warning when trying to feed non-string values to Popen env
This commit is contained in:
parent
4a57cac9c0
commit
2a89a82660
1 changed files with 5 additions and 1 deletions
|
@ -2,6 +2,7 @@ import subprocess
|
|||
import os
|
||||
import threading
|
||||
import queue
|
||||
import logging
|
||||
|
||||
# This import is unused in this file. It will be deleted in future (W0611 PEP8),
|
||||
# but for the momment we keep it due to yunohost moulinette script that used
|
||||
|
@ -12,7 +13,7 @@ quote # This line is here to avoid W0611 PEP8 error (see comments above)
|
|||
|
||||
# Prevent to import subprocess only for common classes
|
||||
CalledProcessError = subprocess.CalledProcessError
|
||||
|
||||
logger = logging.getLogger("moulinette.utils.process")
|
||||
|
||||
# Alternative subprocess methods ---------------------------------------
|
||||
|
||||
|
@ -70,6 +71,9 @@ def call_async_output(args, callback, **kwargs):
|
|||
kwargs["env"] = os.environ
|
||||
kwargs["env"]["YNH_STDINFO"] = str(stdinfo.fdWrite)
|
||||
|
||||
if "env" in kwargs and not all(isinstance(v, str) for v in kwargs["env"].values()):
|
||||
logger.warning("While trying to call call_async_output: env contained non-string values, probably gonna cause issue in Popen(...)")
|
||||
|
||||
try:
|
||||
p = subprocess.Popen(args, **kwargs)
|
||||
|
||||
|
|
Loading…
Reference in a new issue