You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
538 B
Python
10 lines
538 B
Python
import subprocess
|
|
from typing import List
|
|
|
|
def executeProcess(commandSequence: List[str], directory: str = None):
|
|
# process = subprocess.Popen([t.encode('utf-8') for t in commandSequence], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
process = subprocess.Popen(commandSequence, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8', cwd = directory)
|
|
output, error = process.communicate()
|
|
# return output.decode('utf-8'), error.decode('utf-8'), process.returncode
|
|
return output, error, process.returncode
|