Skip to content

Commit

Permalink
Use iterpipes for 2.6 subprocess compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljoseph committed Oct 17, 2013
1 parent 4c9b7f5 commit 349be50
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions changes/shell.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import subprocess
import logging

import iterpipes

log = logging.getLogger(__name__)


def execute(command, dry_run=True):
log.debug('executing %s', command)
if not dry_run:
try:
return subprocess.check_output(command.split(' ')).split('\n')
except subprocess.CalledProcessError, e:
return [result for result in iterpipes.linecmd(command)(None)]
except iterpipes.CalledProcessError, e:
log.debug('return code: %s, output: %s', e.returncode, e.output)
return False
else:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
coverage < 4.0.0
docopt < 1.0.0
iterpipes < 1.0.0
flake8 < 3.0.0
mock < 2.0.0
nose < 2.0.0
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
packages=[changes.__name__],
install_requires=[
'docopt < 1.0.0',
'iterpipes < 1.0.0',
'path.py < 5.0.0',
'semantic_version < 3.0.0',
'virtualenv < 2.0.0',
Expand Down

0 comments on commit 349be50

Please sign in to comment.