PHP: exec (svn commit) does not return any errors and does not work

I am currently writing php files to a directory, I am adding this directory (works fine), and then when I try to make svn commit, it does not work and does not return any error codes. Does anyone know about this?

$tmp = exec('cd '.$this->build_locations[$this->type].'; svn commit --username user --password pw; ls', $output);

I do cd in the directory (where ls worked fine here), I do ls after that to confirm it is still in the directory.

I also tried:

svn help

which returns all the commands to me just fine (so I know this is not a problem without detecting the svn command.

I copied the 777 file to confirm its execution.

Edited Code:

    $output = array();
    $tmp1 = exec("cd ".$this->build_locations[$this->type].";");
    $tmp = exec("svn commit ".$this->build_locations[$this->type].$this->app_id." --username user --password password -m 'test' --non-interactive --trust-server-cert --quiet 2>&1;", $output, $error);
    if($error){
        echo('<pre>');
        print_r($output);
        echo('</pre>');
    }
    exit;

This gives:

Array

    [0] => could not lookup DNS configuration info service: (ipc/send) invalid destination port
    [1] => svn: Commit failed (details follow):
    [2] => svn: Unknown hostname 'my.host'
+2
source share
3 answers

SVN stderr, stdout, . , , stderr stdout, print_r($output), .

exec('svn commit <stuff> 2>&1', $output, $returnStatus);
if ( $returnStatus )
{
    print_r($output);
}

:

Array
(
    [0] => svn: Commit failed (details follow):
    [1] => svn: '/path/to/<stuff>' is not under version control
)

, stderr stdout, , . - , .

: exec (...) - status, , .

2>&1 , .

:

SVN ? .

, , , .

, "svn checkout" PHP , . , .

+4

< errors ( ).

('cd '.$this->build_locations[$this->type].'; svn commit --username user --password pw; ls', $output, $error);
if($error){
   print_r($error);
}

3 .

, $this-type , , - : .; cat /etc/passwd,

$tmp = exec('cd .; cat /etc/passwd; svn commit --username user --password pw; ls', $output);
+1

AFAIK, then svn commit, if the option is -mnot specified, the editor opens to enter a message about the commit. Try to get through -m "Some commit message", maybe this will help.

0
source

Source: https://habr.com/ru/post/1752430/


All Articles