summaryrefslogtreecommitdiffstats
path: root/subcmds
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-02-16 15:38:53 -0500
committerMike Frysinger <vapier@google.com>2021-02-17 15:15:16 +0000
commitf37b9827a966258a0adc2012a7c5c89cf89e4a0f (patch)
treeb74c3f3da0532fa97687779eafb03ec782c0a857 /subcmds
parentc47a235bc591de5fa23e0a9db8d495cb8f063b52 (diff)
downloadgit-repo-f37b9827a966258a0adc2012a7c5c89cf89e4a0f.tar.gz
git_command: rework stdin handling
We only provide input to GitCommand in one place, so inline the logic to be more synchronous and similar to subprocess.run. This makes the code simpler and easier to understand. Change-Id: Ibe498fedf608774bae1f807fc301eb67841c468b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/297142 Reviewed-by: Michael Mortensen <mmortensen@google.com> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds')
-rw-r--r--subcmds/cherry_pick.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/subcmds/cherry_pick.py b/subcmds/cherry_pick.py
index c333fcf4..4b7f1412 100644
--- a/subcmds/cherry_pick.py
+++ b/subcmds/cherry_pick.py
@@ -72,11 +72,9 @@ change id will be added.
72 new_msg = self._Reformat(old_msg, sha1) 72 new_msg = self._Reformat(old_msg, sha1)
73 73
74 p = GitCommand(None, ['commit', '--amend', '-F', '-'], 74 p = GitCommand(None, ['commit', '--amend', '-F', '-'],
75 provide_stdin=True, 75 input=new_msg,
76 capture_stdout=True, 76 capture_stdout=True,
77 capture_stderr=True) 77 capture_stderr=True)
78 p.stdin.write(new_msg)
79 p.stdin.close()
80 if p.Wait() != 0: 78 if p.Wait() != 0:
81 print("error: Failed to update commit message", file=sys.stderr) 79 print("error: Failed to update commit message", file=sys.stderr)
82 sys.exit(1) 80 sys.exit(1)