fixed warning 'RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used'

work related to Bug 3315 - make simpaweb django app a packageable application
This commit is contained in:
Guillaume Raffy 2023-05-23 11:35:15 +02:00
parent b5c2c886f1
commit c387b9dce2
1 changed files with 2 additions and 2 deletions

View File

@ -46,7 +46,7 @@ def log(message):
def executeProgram(astrArguments):
# log('executeProgram : program [%s]' % (','.join(astrArguments)))
popen = subprocess.Popen( astrArguments, bufsize=1, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # bufsize=1 seems to prevent deadlocks that happen 50% the time
popen = subprocess.Popen( astrArguments, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # bufsize=1 seems to prevent deadlocks that happen 50% the time
stdout, stderr = popen.communicate()
# popen.wait()
result = (popen.returncode, stdout.decode(), stderr)
@ -59,7 +59,7 @@ def executeCommand(command):
"""
executes the shell command such as 'set x=1; myprog $x'
"""
popen = subprocess.Popen( [command], bufsize=1, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, executable='/bin/bash') # bufsize=1 seems to prevent deadlocks that happen 50% the time
popen = subprocess.Popen( [command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, executable='/bin/bash') # bufsize=1 seems to prevent deadlocks that happen 50% the time
# if we don't specify the optional executable argument, then the default non interactive shell will be used. On debian, the default non-interactive shell is dash, which doesn't understand the keyword 'source' that we use in many places
stdout, stderr = popen.communicate()
# popen.wait()