Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
amoffat committed Apr 28, 2020
2 parents a2f7323 + 114e6ee commit 6443ce1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 1.13.1 - 4/28/20
* regression fix if `_fg=False` [#520](https://github.com/amoffat/sh/issues/520)

## 1.13.0 - 4/27/20
* minor Travis CI fixes [#492](https://github.com/amoffat/sh/pull/492)
* bugfix for boolean long options not respecting `_long_prefix` [#488](https://github.com/amoffat/sh/pull/488)
Expand Down
4 changes: 2 additions & 2 deletions sh.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#===============================================================================


__version__ = "1.13.0"
__version__ = "1.13.1"
__project_url__ = "https://github.com/amoffat/sh"


Expand Down Expand Up @@ -1104,7 +1104,7 @@ def fg_validator(passed_kwargs, merged_kwargs):
whitelist = set(("env", "fg", "cwd"))
offending = set(passed_kwargs.keys()) - whitelist

if "fg" in passed_kwargs and offending:
if "fg" in passed_kwargs and passed_kwargs["fg"] and offending:
invalid.append(("fg", msg))
return invalid

Expand Down
13 changes: 13 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1731,6 +1731,19 @@ def test_fg(self):
# `python` has an env baked into it, and we want `_env` to be None for
# coverage
system_python(py.name, _fg=True)

def test_fg_false(self):
""" https://github.com/amoffat/sh/issues/520 """
py = create_tmp_test("print('hello')")
buf = StringIO()
python(py.name, _fg=False, _out=buf)
self.assertEqual(buf.getvalue(), "hello\n")

def test_fg_true(self):
""" https://github.com/amoffat/sh/issues/520 """
py = create_tmp_test("print('hello')")
buf = StringIO()
self.assertRaises(TypeError, python, py.name, _fg=True, _out=buf)

def test_fg_env(self):
py = create_tmp_test("""
Expand Down

0 comments on commit 6443ce1

Please sign in to comment.