PHP的SVN更新 – TortoiseSVN


<?php exec('"C:\Program Files\TortoiseSVN\bin\svn.exe" update "c:\wamp\www\project"'); 

这将导致无限循环,不会返回任何结果。 我究竟做错了什么?


Windows上,我试图通过使用PHP更新项目。 我在使用命令行时遇到问题:我需要视觉反馈(在发生冲突时很重要),所以我不想以后台进程开始。 这可能吗?


 <?php $todo = "cd \"C:\\Program Files\\TortoiseSVN\\bin\\\""; $todo2 = "START TortoiseProc.exe /command:update /path:\"C:\\wamp\\www\\project\\\" /closeonend:0"; pclose(popen($todo, "r")); pclose(popen($todo2, "r")); 

Solutions Collecting From Web of "PHP的SVN更新 – TortoiseSVN"

我会删除exec并使用proc_open (请参阅


 <?php // setup pipes that you'll use $descriptorspec = array( 0 => array("pipe", "r"), // stdin 1 => array("pipe", "w"), // stdout 2 => array("pipe", "w") // stderr ); // call your process $process = proc_open('"C:\Program Files\TortoiseSVN\bin\svn.exe" update "c:\wamp\www\project"', $descriptorspec, $pipes); // if process is called, pipe data to variables which can later be processed. if(is_resource($process)) { $stdin = stream_get_contents($pipes[0]); $stdout = stream_get_contents($pipes[1]); $stderr = stream_get_contents($pipes[2]); fclose($pipes[0]); fclose($pipes[1]); fclose($pipes[2]); $return_value = proc_close($process); } // Now it's up to you what you want to do with the data you've got. // Remember that this is merely an example, you'll probably want to // modify the output handling to your own likings... header('Content-Type: text/plain; charset=UTF-8'); // check if there was an error, if not - dump the data if($return_value === -1) { echo('The termination status of the process indicates an error.'."\r\n"); } echo('---------------------------------'."\r\n".'STDIN contains:'."\r\n"); echo($stdin); echo('---------------------------------'."\r\n".'STDOUTcontains:'."\r\n"); echo($stdout); echo('---------------------------------'."\r\n".'STDERR contains:'."\r\n"); echo($stderr); ?>