1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

When executing a repository passthru command via CommandEngine, don't set a timeout

Summary:
Ref T13541. The passthru future does not have time limit behavior, so if we reach this code we currently fail.

Phabricator never reaches this code normally, but this code is reachable during debugging if you try to foreground a slow fetch to inspect it.

Passthru commands generally only make sense to run interactively, and the caller or control script can enforce their own timeouts (usually by pressing "^C" with their fingers).

Test Plan: Used a debugging script to run ref-by-ref fetches in the foreground.

Maniphest Tasks: T13541

Differential Revision: https://secure.phabricator.com/D21284
This commit is contained in:
epriestley 2020-05-22 05:42:34 -07:00
parent 4fd0628fae
commit 959a835b95

View file

@ -120,6 +120,7 @@ abstract class DiffusionCommandEngine extends Phobject {
public function newFuture() {
$argv = $this->newCommandArgv();
$env = $this->newCommandEnvironment();
$is_passthru = $this->getPassthru();
if ($this->getSudoAsDaemon()) {
$command = call_user_func_array('csprintf', $argv);
@ -127,7 +128,7 @@ abstract class DiffusionCommandEngine extends Phobject {
$argv = array('%C', $command);
}
if ($this->getPassthru()) {
if ($is_passthru) {
$future = newv('PhutilExecPassthru', $argv);
} else {
$future = newv('ExecFuture', $argv);
@ -139,7 +140,9 @@ abstract class DiffusionCommandEngine extends Phobject {
// to try to avoid cases where `git fetch` hangs for some reason and we're
// left sitting with a held lock forever.
$repository = $this->getRepository();
$future->setTimeout($repository->getEffectiveCopyTimeLimit());
if (!$is_passthru) {
$future->setTimeout($repository->getEffectiveCopyTimeLimit());
}
return $future;
}