1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 01:10:58 +01:00

Timeout interpreter {{{ ... }}} blocks after 15 seconds

Summary: Fixes T4149. This could be a little cleaner (configurable time limits, explicit timeout errors) but stop the major case of looping/infinite commands.

Test Plan: Added `sleep 5 &&` and set timeout to 1, saw an error + kill.

Reviewers: btrahan, skyronic

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4149

Differential Revision: https://secure.phabricator.com/D7651
This commit is contained in:
epriestley 2013-11-25 14:55:25 -08:00
parent e944cf8ff4
commit 3d9f656cfc
3 changed files with 6 additions and 1 deletions

View file

@ -29,6 +29,7 @@ final class PhabricatorRemarkupBlockInterpreterCowsay
$tongue,
$cow);
$future->setTimeout(15);
$future->write($content);
list($err, $stdout, $stderr) = $future->resolve();

View file

@ -14,6 +14,7 @@ final class PhabricatorRemarkupBlockInterpreterFiglet
}
$future = id(new ExecFuture('figlet'))
->setTimeout(15)
->write(trim($content, "\n"));
list($err, $stdout, $stderr) = $future->resolve();

View file

@ -14,6 +14,7 @@ final class PhabricatorRemarkupBlockInterpreterGraphviz
}
$future = id(new ExecFuture('dot -T%s', 'png'))
->setTimeout(15)
->write(trim($content));
list($err, $stdout, $stderr) = $future->resolve();
@ -21,7 +22,9 @@ final class PhabricatorRemarkupBlockInterpreterGraphviz
if ($err) {
return $this->markupError(
pht(
'Execution of `dot` failed, check your syntax: %s', $stderr));
'Execution of `dot` failed (#%d), check your syntax: %s',
$err,
$stderr));
}
$file = PhabricatorFile::buildFromFileDataOrHash(