Skip to content

Commit 51ff95d

Browse files
committed
feature #14743 [Process] add docs for ExecutableFinder (dunglas)
This PR was squashed before being merged into the 4.4 branch. Discussion ---------- [Process] add docs for ExecutableFinder This class has always been there, but it isn't documented. Commits ------- d922ed4 [Process] add docs for ExecutableFinder
2 parents 976d3be + d922ed4 commit 51ff95d

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

components/process.rst

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,10 +483,32 @@ Use :method:`Symfony\\Component\\Process\\Process::disableOutput` and
483483
However, it is possible to pass a callback to the ``start``, ``run`` or ``mustRun``
484484
methods to handle process output in a streaming fashion.
485485

486+
487+
Finding an Executable
488+
---------------------
489+
490+
The Process component provides a utility class called
491+
:class:`Symfony\\Component\\Process\\ExecutableFinder` which finds
492+
and returns the absolute path of an executable::
493+
494+
use Symfony\Component\Process\ExecutableFinder;
495+
496+
$executableFinder = new ExecutableFinder();
497+
$chromedriverPath = $executableFinder->find('chromedriver');
498+
// $chromedriverPath = '/usr/local/bin/chromedriver' (the result will be different on your computer)
499+
500+
The :method:`Symfony\\Component\\Process\\ExecutableFinder::find` method also takes extra parameters to specify a default value
501+
to return and extra directories where to look for the executable::
502+
503+
use Symfony\Component\Process\ExecutableFinder;
504+
505+
$executableFinder = new ExecutableFinder();
506+
$chromedriverPath = $executableFinder->find('chromedriver', '/path/to/chromedriver', ['local-bin/']);
507+
486508
Finding the Executable PHP Binary
487509
---------------------------------
488510

489-
This component also provides a utility class called
511+
This component also provides a special utility class called
490512
:class:`Symfony\\Component\\Process\\PhpExecutableFinder` which returns the
491513
absolute path of the executable PHP binary available on your server::
492514

0 commit comments

Comments
 (0)