[英]PHP exec output is abbreviate and cut
I try to catch the output of git log files 我尝试捕获git日志文件的输出
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 但是使用php exec时,字符串被切断了
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.