Skip to content

Commit

Permalink
Exit early on patch failure if bloom is being run non-interactively. (#…
Browse files Browse the repository at this point in the history
…668)

* Export BLOOM_NON_INTERACTIVE to track actions environment.

If git-bloom-release is run non-interactively then that should be
propagated to the actions command so that actions are not blocked on
interactivity.

This patch also makes the minor optimization of only making one copy of
the environment to pass to the actions run. I don't think this makes a
major difference in performance but it is one less thing to worry about
and environment changes from children should not persist to subsequent
children or "bubble up" to the parent process.

* Exit early on patch failure if bloom is being run non-interactively.

* Indentation.

* Use isatty() instead of requiring an environment variable.

* Revert "Export BLOOM_NON_INTERACTIVE to track actions environment."

This reverts commit a9fe30c.
The updated implementation relies on using isatty for interactive
terminal detection rather than an exported environment variable.
  • Loading branch information
nuclearsandwich authored Apr 19, 2022
1 parent 13b921c commit 512ecbe
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bloom/commands/git/patch/import_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ def import_patches(directory=None):
cmd = 'git am --3way {0}*.patch'.format(tmp_dir + os.sep)
execute_command(cmd, cwd=directory)
except subprocess.CalledProcessError as e:
# Only try interactive resolution if stdin is a terminal.
if not sys.stdin.isatty():
error("Failed to apply one or more patches for the "
"'{0}' branch.".format(str(e)))
sys.exit("'git-bloom-patch import' aborted.")
warning("Failed to apply one or more patches for the "
"'{0}' branch.".format(str(e)))
info('', use_prefix=False)
Expand Down

0 comments on commit 512ecbe

Please sign in to comment.