public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/catalyst:3.0 commit in: catalyst/
Date: Wed, 22 Jan 2014 05:04:13 +0000 (UTC)	[thread overview]
Message-ID: <1390365361.4fc05408af380d443178943f3194b485da92f6b8.dol-sen@gentoo> (raw)

commit:     4fc05408af380d443178943f3194b485da92f6b8
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 22 01:55:04 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Jan 22 04:36:01 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=4fc05408

Take most cmd() code out to the try: except: pairs

---
 catalyst/support.py | 34 +++++++++++++++++++---------------
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/catalyst/support.py b/catalyst/support.py
index 3db1509..cafb5d2 100644
--- a/catalyst/support.py
+++ b/catalyst/support.py
@@ -120,25 +120,29 @@ def find_binary(myc):
 	return None
 
 
-def cmd(mycmd, myexc="", env={}, debug=False):
+def cmd(mycmd, myexc="", env={}, debug=False, fail_func=None):
+	#print "***** cmd()"
+	sys.stdout.flush()
+	args=[BASH_BINARY]
+	if "BASH_ENV" not in env:
+		env["BASH_ENV"] = "/etc/spork/is/not/valid/profile.env"
+	if debug:
+		args.append("-x")
+	args.append("-c")
+	args.append(mycmd)
+
+	#if debug:
+	print "***** cmd(); args =", args
 	try:
-		sys.stdout.flush()
-		args=[BASH_BINARY]
-		if "BASH_ENV" not in env:
-			env["BASH_ENV"] = "/etc/spork/is/not/valid/profile.env"
-		if debug:
-			args.append("-x")
-		args.append("-c")
-		args.append(mycmd)
-
-		#if debug:
-		print "***** cmd(); args =", args
 		proc = Popen(args, env=env)
-		if proc.wait() != 0:
-			raise CatalystError("cmd() NON-zero return value from: %s" % myexc,
-				print_traceback=False)
 	except:
 		raise
+	if proc.wait() != 0:
+		if fail_func:
+			print "CMD(), NON-Zero command return.  Running fail_func()"
+			fail_func()
+		raise CatalystError("cmd() NON-zero return value from: %s" % myexc,
+			print_traceback=False)
 
 
 def file_locate(settings,filelist,expand=1):


             reply	other threads:[~2014-01-22  5:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-22  5:04 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-04-18 16:52 [gentoo-commits] proj/catalyst:3.0 commit in: catalyst/ Brian Dolbec
2014-04-18 16:52 Brian Dolbec
2014-04-18 16:52 Brian Dolbec
2014-01-22  5:04 Brian Dolbec
2014-01-22  5:04 Brian Dolbec
2014-01-22  5:04 Brian Dolbec
2013-11-21  9:06 Brian Dolbec
2013-11-21  9:06 Brian Dolbec
2013-11-21  9:06 Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1390365361.4fc05408af380d443178943f3194b485da92f6b8.dol-sen@gentoo \
    --to=brian.dolbec@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox