Skip to content

Commit

Permalink
Merge pull request #150 from martinholmer/use-run
Browse files Browse the repository at this point in the history
Switch from subprocess.check_call to newer subprocess.run
  • Loading branch information
martinholmer authored Dec 18, 2018
2 parents 7191c29 + ed359ca commit 41d524c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
17 changes: 17 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ Go [here](https://github.com/PSLmodels~/Package-Builder/pulls?q=is%3Apr+is%3Aclo
for a complete commit history.


2018-12-18 Release 0.18.0
-------------------------
(last merged pull request is
[#150](https://github.com/PSLmodels/Package-Builder/pull/150))

**API Changes**
- None

**New Features**
- Use newer `subprocess.run` in `os_call` utility function
[[#150](https://github.com/PSLmodels/Package-Builder/pull/150)
by Martin Holmer]

**Bug Fixes**
- None


2018-12-17 Release 0.17.0
-------------------------
(last merged pull request is
Expand Down
9 changes: 5 additions & 4 deletions pkgbld/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@

def os_call(cmd):
"""
Execute specified cmd in operating-system subprocess.
Execute specified cmd string in operating-system subprocess.
"""
assert isinstance(cmd, str)
try:
subprocess.check_call(cmd, shell=True)
subprocess.run(cmd, shell=True, check=True, stdout=subprocess.PIPE)
except subprocess.CalledProcessError as err:
msg = 'non-zero return code {} generated by command:\n{}'
raise OSError(msg.format(err.returncode, cmd))
msg = 'non-zero return code {} generated by command:\n{}\n>output: {}'
raise OSError(msg.format(err.returncode, cmd, err.output))


def file_revision(filename, pattern, replacement):
Expand Down

0 comments on commit 41d524c

Please sign in to comment.