Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Monkey-patch check_output

  • Loading branch information...
commit c6d644281d1a0414860681c195fd9e4f6fa873a5 1 parent 7a88094
@sean-m authored
Showing with 22 additions and 0 deletions.
  1. +22 −0 jira-init
View
22 jira-init
@@ -27,6 +27,28 @@ APP_DIR = '/data/jira_main/jira-std/'
APP_START = 'bin/start-jira.sh'
APP_STOP = 'bin/stop-jira.sh'
+
+def check_output(*popenargs, **kwargs):
+ """Run command with arguments and return its output as a byte string.
+
+ Backported from Python 2.7 as it's implemented as pure python on stdlib.
+
+ >>> check_output(['/usr/bin/python', '--version'])
+ Python 2.6.2
+ """
+ process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
+ output, unused_err = process.communicate()
+ retcode = process.poll()
+ if retcode:
+ cmd = kwargs.get("args")
+ if cmd is None:
+ cmd = popenargs[0]
+ error = subprocess.CalledProcessError(retcode, cmd)
+ error.output = output
+ raise error
+ return output
+
+
def lock():
"""
Create the /var/lock/subsys file
Please sign in to comment.
Something went wrong with that request. Please try again.