简体   繁体   中英

PHP exec output is abbreviate and cut

I try to catch the output of git log files

the shell

/usr/bin/git log --stat --pretty=format:%an*_*%cd*_*%H*_*%s

output

rrr*_*Wed Mar 29 15:03:44 2016 +0800*_*51c32954639dffbdba18050527ca56b0ec243453*_*bug#1395
 mine-web-manage/src/main/webapp/WEB-INF/views/organ/courseForm.jsp                                         |  6 +++++-
 mine-web-server/src/main/java/com/mine/web/server/controller/organ/RestPublicOrganTeacherController.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 1 deletion(-)

but with php exec, the string is cut off

the code

$cmd = "/usr/bin/git log --stat --pretty=format:%an*_*%cd*_*%H*_*%s";
exec($cmd, $list, $return);
var_dump($list);

output

  string(90) "rrr*_*Wed Mar 29 15:03:44 2016 +0800*_*51c32954639dffbdba18050527ca56b0ec243453*_*bug#1395"
  [18] =>
  string(60) " .../main/webapp/WEB-INF/views/organ/courseForm.jsp |  6 ++-"
  [19] =>
  string(79) " .../organ/RestPublicOrganTeacherController.java    | 53 ++++++++++++++++++++++"
  [20] =>
  string(49) " 2 files changed, 58 insertions(+), 1 deletion(-)"

and I tried the following methods, all not work,result all cut off

1, $cmd . " 2>&1"
2, $cmd . " > /tmp/cmd.txt"
3, passthru($cmd, $list, $return);

i want to get full string in output

Anyone has some idea about what is happening?

Thank you very much in advance for your help.

use the code is fine

git log  --stat=200 --pretty=format:%an*_*%cd*_*%H*_*%s

show full file path in git log

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM