Skip to content

Commit

Permalink
Merge pull request NCAR#295 from climbfuji/fix_decoding_errors_stampede
Browse files Browse the repository at this point in the history
Fix decoding errors in scripts/common.py's execute_cmd
  • Loading branch information
climbfuji committed Jun 7, 2020
2 parents 7c3673d + a477b63 commit a07eb7f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# These owners will be the default owners for everything in the repo.
#* @defunkt
* @climbfuji @llpcarson @grantfirl @gold2718 @JulieSchramm
* @climbfuji @llpcarson @grantfirl @JulieSchramm

# Order is important. The last matching pattern has the most precedence.
# So if a pull request only touches javascript files, only these owners
Expand Down
11 changes: 6 additions & 5 deletions scripts/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,19 @@ def execute(cmd, abort = True):
status = p.returncode
if debug:
message = 'Execution of "{0}" returned with exit code {1}\n'.format(cmd, status)
message += ' stdout: "{0}"\n'.format(stdout.decode('ascii').rstrip('\n'))
message += ' stderr: "{0}"'.format(stderr.decode('ascii').rstrip('\n'))
message += ' stdout: "{0}"\n'.format(stdout.decode(encoding='ascii', errors='ignore').rstrip('\n'))
message += ' stderr: "{0}"'.format(stderr.decode(encoding='ascii', errors='ignore').rstrip('\n'))
logging.debug(message)
if not status == 0:
message = 'Execution of command {0} failed, exit code {1}\n'.format(cmd, status)
message += ' stdout: "{0}"\n'.format(stdout.decode('ascii').rstrip('\n'))
message += ' stderr: "{0}"'.format(stderr.decode('ascii').rstrip('\n'))
message += ' stdout: "{0}"\n'.format(stdout.decode(encoding='ascii', errors='ignore').rstrip('\n'))
message += ' stderr: "{0}"'.format(stderr.decode(encoding='ascii', errors='ignore').rstrip('\n'))
if abort:
raise Exception(message)
else:
logging.error(message)
return (status, stdout.decode('ascii').rstrip('\n'), stderr.decode('ascii').rstrip('\n'))
return (status, stdout.decode(encoding='ascii', errors='ignore').rstrip('\n'),
stderr.decode(encoding='ascii', errors='ignore').rstrip('\n'))

def split_var_name_and_array_reference(var_name):
"""Split an expression like foo(:,a,1:ddt%ngas)
Expand Down

0 comments on commit a07eb7f

Please sign in to comment.