-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,47 @@ | ||
88c88 | ||
< from subprocess import check_call | ||
--- | ||
> from subprocess import check_call, CalledProcessError | ||
101,107c101,122 | ||
< check_call( | ||
< argv_command, | ||
< cwd=directory, | ||
< stdout=fd_out, | ||
< stderr=fd_err, | ||
< env=os.environ, | ||
< ) | ||
--- | ||
> try: | ||
> check_call( | ||
> argv_command, | ||
> cwd=directory, | ||
> stdout=fd_out, | ||
> stderr=fd_err, | ||
> env=os.environ, | ||
> ) | ||
> except CalledProcessError as exc: | ||
> print("CalledProcessError stdout") | ||
> if fd_out is not None: | ||
> with open(output_path) as fin: | ||
> print(''.join(fin.readlines())) | ||
> else: | ||
> print("fd_out None") | ||
> print("CalledProcessError stderr") | ||
> if fd_err is not None: | ||
> with open(error_path) as fin: | ||
> print(''.join(fin.readlines())) | ||
> else: | ||
> print("fd_err None") | ||
> raise | ||
--- genericfileio.py.orig 2025-02-13 13:41:09.523396827 -0500 | ||
+++ genericfileio.py 2025-02-13 13:44:12.363487148 -0500 | ||
@@ -85,7 +85,7 @@ | ||
""" | ||
|
||
import os | ||
- from subprocess import check_call | ||
+ from subprocess import check_call, CalledProcessError | ||
|
||
argv_command = self.get_command(inputfile) | ||
mode = 'wb' if not append else 'ab' | ||
@@ -98,13 +98,28 @@ | ||
fd_err = stack.enter_context(open(error_path, mode)) | ||
else: | ||
fd_err = None | ||
- check_call( | ||
- argv_command, | ||
- cwd=directory, | ||
- stdout=fd_out, | ||
- stderr=fd_err, | ||
- env=os.environ, | ||
- ) | ||
+ try: | ||
+ check_call( | ||
+ argv_command, | ||
+ cwd=directory, | ||
+ stdout=fd_out, | ||
+ stderr=fd_err, | ||
+ env=os.environ, | ||
+ ) | ||
+ except CalledProcessError as exc: | ||
+ print("CalledProcessError stdout") | ||
+ if fd_out is not None: | ||
+ with open(output_path) as fin: | ||
+ print(''.join(fin.readlines())) | ||
+ else: | ||
+ print("fd_out None") | ||
+ print("CalledProcessError stderr") | ||
+ if fd_err is not None: | ||
+ with open(error_path) as fin: | ||
+ print(''.join(fin.readlines())) | ||
+ else: | ||
+ print("fd_err None") | ||
+ raise | ||
|
||
@abstractmethod | ||
def version(self): |