Skip to content

Commit

Permalink
Added timeout option
Browse files Browse the repository at this point in the history
  • Loading branch information
yohang committed Aug 5, 2013
1 parent f68be8d commit 2673a67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@
},
"autoload": {
"psr-0": { "Yohang": "src/" }
},
"branch-alias": {
"dev-master": "1.1.*-dev"
}
}
8 changes: 7 additions & 1 deletion src/Yohang/DependencyTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ protected static function getOptions($event)
}

/**
* @param arrat $args
* @param array $options
* @param string $cmd
* @param array $args
* @param string $ifError
*
* @throws \RuntimeException
*/
protected static function execCommand($options, $cmd, array $args, $ifError)
Expand All @@ -69,6 +72,9 @@ protected static function execCommand($options, $cmd, array $args, $ifError)

$out = '';
$process = ProcessBuilder::create(array_merge(array($cmd), $args))->getProcess();
if (isset($options['timeout'])) {
$process->setTimeout($options['timeout']);
}
$process->run(function($type, $buffer) use (&$out) { $out .= $buffer; });

if (!$process->isSuccessful()) {
Expand Down

0 comments on commit 2673a67

Please sign in to comment.