pipe - Python subprocess/Popen stdout is truncated -


the output of popen stdout not same running command shell, or using os.system:

cmd = ['git', 'diff', commithash, '--stat']  print popen(cmd, stdout=pipe).stdout.read().strip() os.system(' '.join(cmd)) 

the output popen:

 src/tech/dalvik/sidebar.md                         |   10 -  .../encryption/android_crypto_implementation.md    |  359 --  src/tech/encryption/index.md                       |   22 -  src/tech/encryption/sidebar.md                     |    9 -  src/tech/index.md                                  |   58 -  src/tech/nfc/index.md                              |   25 -  src/tech/nfc/sidebar.md                            |    7 -  src/tech/sidebar.md                                |    5 -  templates/footer                                   |    3 +-  templates/includes                                 |    2 +-  templates/sidebar                                  |    2 +-  257 files changed, 32311 insertions(+), 11358 deletions(-) 

the output os.system (same running shell)

 src/tech/dalvik/sidebar.md                                         |   10 -  src/tech/encryption/android_crypto_implementation.md               |  359 ---------  src/tech/encryption/index.md                                       |   22 -  src/tech/encryption/sidebar.md                                     |    9 -  src/tech/index.md                                                  |   58 --  src/tech/nfc/index.md                                              |   25 -  src/tech/nfc/sidebar.md                                            |    7 -  src/tech/sidebar.md                                                |    5 -  templates/footer                                                   |    3 +-  templates/includes                                                 |    2 +-  templates/sidebar                                                  |    2 +-  257 files changed, 32311 insertions(+), 11358 deletions(-) 

how can subprocess.popen works os.system?

i found similar question here: stdout captured pipe in python truncated, setting lang environment variable doesn't seem work.

thanks!

i don't think output being truncated.

probably git giving different outputs, trying best present diff stat you.

from example, guess issue different values envvar columns.

check how many columns terminal have with:

$ echo $columns

and set envvar in popen call:

popen(cmd, stdout=pipe, env={'columns':'249'})


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -