Skip to content

Commit

Permalink
Modify how to execute binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
jmhorcas committed Nov 7, 2024
1 parent 73a68f2 commit 196474b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions flamapy/metamodels/bdd_metamodel/models/bdd_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ def _set_global_constants(self) -> None:
caller_dir = os.getcwd()
os.chdir(Path(__file__).parent)
if self.system == 'Windows':
shell = subprocess.run(['wsl', 'pwd'], stdout=subprocess.PIPE, check=True)
shell = subprocess.Popen(['wsl', 'pwd'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, text=True, shell=True)
else:
shell = subprocess.run(['pwd'], stdout=subprocess.PIPE, check=True)
self.bdd4var_dir = shell.stdout.decode(str(locale.getdefaultlocale()[1])).strip()
shell = subprocess.Popen(['pwd'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, text=True, shell=True)
stdout, sdterr = shell.communicate()
self.bdd4var_dir = stdout.strip()
os.chdir(caller_dir)

def run(self, binary: str, *args: Any) -> Any:
Expand All @@ -102,10 +103,12 @@ def run(self, binary: str, *args: Any) -> Any:
command = [bin_file, bin_dir]
else:
command = [bin_file, bin_dir] + list(args)
return subprocess.run(command,
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
check=True)
return subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
check=True,
text=True,
shell=True)

@staticmethod
def check_file_existence(filename: str, extension: str = '') -> str:
Expand Down

0 comments on commit 196474b

Please sign in to comment.