[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: mercurial и proc_open
olgatcpip
Доброго времени суток.

Нужна серьезная помощь.

Здача стоит так: использовать mercurial API через php

У меркуриала есть командочка hg, с которой я успешно игралась...
И казлось нет проблем выполнять её из php proc_open

<?php

error_reporting(E_ALL);
ini_set('display_errors','on');

echo '<pre>';
$cwd = '/var/www/hgrepo/';

proc('ls','-l');

//proc('hg','--config ui.interactive=yes');
proc('hg','-v log');

echo '=============='."\n";


function proc($proc,$param)
{
global $cwd;
echo '====== proc ========'."\n";
echo "$proc $param\n";
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
2 => array("file", "/var/www/html/pm/services/support/hg/out.txt", "a") // stderr is a file to write to
);

$env = null;

$process = proc_open($proc, $descriptorspec, $pipes, $cwd, $env);

if (is_resource($process)) {

fwrite($pipes[0], $param);
fclose($pipes[0]);

echo "\n 1: ". stream_get_contents($pipes[1]);
fclose($pipes[1]);

$return_value = proc_close($process);

echo "command returned $return_value\n";
}
}


proc('ls','-l'); - выводит список файлов, всё хорошо

proc('hg','-v log'); - должен вывести лог...
полагаю что это равно ввожу
hg -v log

в командную строку в нужной мне директории
а он выводит мне информацию, буд-то я ошиблась.. даже не знаю синтаксисом или ещё чем похожим.... Я не понимаю, почему такая обратная связь :(

Цитата
1: Mercurial Distributed SCM

basic commands:

add        add the specified files on the next commit
annotate    show changeset information by line for each file
clone      make a copy of an existing repository
commit      commit the specified files or all outstanding changes
diff        diff repository (or selected files)
export      dump the header and diffs for one or more changesets
forget      forget the specified files on the next commit
init        create a new repository in the given directory
log        show revision history of entire repository or files
merge      merge working directory with another revision
phase      set or show the current phase name
pull        pull changes from the specified source
push        push changes to the specified destination
remove      remove the specified files on the next commit
serve      start stand-alone webserver
status      show changed files in the working directory
summary    summarize working directory state
update      update working directory (or switch revisions)

use "hg help" for the full list of commands or "hg -v" for details
command returned 0


При этом я пулей лезу на сервер выполняю команду hg -v log и все хорошо, а через php ересь несет! Что делать? Мне кажется я не понимаю как работает proc_open

Объясните, пожалуйста (доку прочитала много раз - не помогает :( )


_____________
Ласковое слово и кошке приятно... Плюсик в карму сойдет wink.gif
*smarty дока - новая любовь
Моё рукотворение ругайте, хвалите smile.gif
Веду маленький блог
в этом блоге публикую новые работы
WMR217126627282 wink.gif

Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.