Thread (54 messages) flat view 54 messages, 5 authors, 2019-12-07
STALE2437d

[PATCH v5 06/15] git-p4: remove p4_write_pipe() and write_pipe() return values

From: Ben Keene via GitGitGadget <hidden>
Date: 2019-12-07 17:47:57
Subsystem: the rest · Maintainer: Linus Torvalds

From: Ben Keene <redacted>

The git-p4 functions write_pipe() and p4_write_pipe() originally
return the number of bytes returned from the system call. However,
this is a misleading value when this function is run by Python 3.

Modify the functions write_pipe() and p4_write_pipe() to remove the
return value.  The return value for both functions is the number of
bytes, but the meaning is lost under python3 since the count does not
match the number of characters that may have been encoded.
Additionally, the return value was never used, so this is removed to
avoid future ambiguity.

Signed-off-by: Ben Keene <redacted>
---
 git-p4.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/git-p4.py b/git-p4.py
index cc6c490e2c..e7c24817ad 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -171,6 +171,8 @@ def die(msg):
         sys.exit(1)
 
 def write_pipe(c, stdin):
+    """ Executes the command 'c', passing 'stdin' on the standard input
+    """
     if verbose:
         sys.stderr.write('Writing pipe: %s\n' % str(c))
 
@@ -182,11 +184,12 @@ def write_pipe(c, stdin):
     if p.wait():
         die('Command failed: %s' % str(c))
 
-    return val
 
 def p4_write_pipe(c, stdin):
+    """ Runs a P4 command 'c', passing 'stdin' data to P4
+    """
     real_cmd = p4_build_cmd(c)
-    return write_pipe(real_cmd, stdin)
+    write_pipe(real_cmd, stdin)
 
 def read_pipe_full(c):
     """ Read output from  command. Returns a tuple
-- 
gitgitgadget
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help