Page MenuHomePhorge

No OneTemporary

diff --git a/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterCowsay.php b/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterCowsay.php
index 07e6ca611b..e4c5be4c30 100644
--- a/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterCowsay.php
+++ b/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterCowsay.php
@@ -1,55 +1,56 @@
<?php
final class PhabricatorRemarkupBlockInterpreterCowsay
extends PhutilRemarkupBlockInterpreter {
public function getInterpreterName() {
return 'cowsay';
}
public function markupContent($content, array $argv) {
if (!Filesystem::binaryExists('cowsay')) {
return $this->markupError(
pht('Unable to locate the `cowsay` binary. Install cowsay.'));
}
$bin = idx($argv, 'think') ? 'cowthink' : 'cowsay';
$eyes = idx($argv, 'eyes', 'oo');
$tongue = idx($argv, 'tongue', ' ');
$cow = idx($argv, 'cow', 'default');
// NOTE: Strip this aggressively to prevent nonsense like
// `cow=/etc/passwd`. We could build a whiltelist with `cowsay -l`.
$cow = preg_replace('/[^a-z.-]+/', '', $cow);
$future = new ExecFuture(
'%s -e %s -T %s -f %s ',
$bin,
$eyes,
$tongue,
$cow);
+ $future->setTimeout(15);
$future->write($content);
list($err, $stdout, $stderr) = $future->resolve();
if ($err) {
return $this->markupError(
pht(
'Execution of `cowsay` failed:', $stderr));
}
if ($this->getEngine()->isTextMode()) {
return $stdout;
}
return phutil_tag(
'div',
array(
'class' => 'PhabricatorMonospaced remarkup-cowsay',
),
$stdout);
}
}
diff --git a/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterFiglet.php b/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterFiglet.php
index 35370e2aa2..aae99d7dd5 100644
--- a/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterFiglet.php
+++ b/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterFiglet.php
@@ -1,40 +1,41 @@
<?php
final class PhabricatorRemarkupBlockInterpreterFiglet
extends PhutilRemarkupBlockInterpreter {
public function getInterpreterName() {
return 'figlet';
}
public function markupContent($content, array $argv) {
if (!Filesystem::binaryExists('figlet')) {
return $this->markupError(
pht('Unable to locate the `figlet` binary. Install figlet.'));
}
$future = id(new ExecFuture('figlet'))
+ ->setTimeout(15)
->write(trim($content, "\n"));
list($err, $stdout, $stderr) = $future->resolve();
if ($err) {
return $this->markupError(
pht(
'Execution of `figlet` failed:', $stderr));
}
if ($this->getEngine()->isTextMode()) {
return $stdout;
}
return phutil_tag(
'div',
array(
'class' => 'PhabricatorMonospaced remarkup-figlet',
),
$stdout);
}
}
diff --git a/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterGraphviz.php b/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterGraphviz.php
index 79ec668f8c..e165f17532 100644
--- a/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterGraphviz.php
+++ b/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterGraphviz.php
@@ -1,44 +1,47 @@
<?php
final class PhabricatorRemarkupBlockInterpreterGraphviz
extends PhutilRemarkupBlockInterpreter {
public function getInterpreterName() {
return 'dot';
}
public function markupContent($content, array $argv) {
if (!Filesystem::binaryExists('dot')) {
return $this->markupError(
pht('Unable to locate the `dot` binary. Install Graphviz.'));
}
$future = id(new ExecFuture('dot -T%s', 'png'))
+ ->setTimeout(15)
->write(trim($content));
list($err, $stdout, $stderr) = $future->resolve();
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(
$stdout,
array(
'name' => 'graphviz.png',
));
if ($this->getEngine()->isTextMode()) {
return '<'.$file->getBestURI().'>';
}
return phutil_tag(
'img',
array(
'src' => $file->getBestURI(),
));
}
}

File Metadata

Mime Type
text/x-diff
Expires
Jan 19 2025, 20:47 (6 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128590
Default Alt Text
(4 KB)

Event Timeline