2

I have a python script which captures repo command.

import subprocess

processing(commandforrepo)

def processing(repocmd):
    process = None
    process = subprocess.Popen(repocmd,
                          stdout=subprocess.PIPE, stderr=None, shell=True)
    process.communicate()

In the particular command, I am trying to parse a list of repocmd to compare two branches and print out the differences

"repo forall $(repo forall -c 'echo $REPO_PROJECT')\
     -c 'git log --abbrev-commit --pretty=oneline --no-merges \
     --cherry-pick --left-only HEAD...$REPO_RREV'"

Attempted to run the script on the terminal but the command did not get executed. However, when this command is issued on the terminal, it produces a list of differences between the two branches.

Any clue as to what is missing?

Arpit Solanki
  • 9,567
  • 3
  • 41
  • 57
  • i think you forgot to set a variable to the output of Proc.communicate(), what are you expecting will happen? You're piping stdout to your script, and not doing anything with it. – TTT Mar 16 '18 at 04:51

1 Answers1

0

Warning: most of the standard output for Git command are done on... stderr.
See here for why: informative messages are on stderr only.

So make sure to parse stderr, not stdout.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250