File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use Symfony \Component \Process \PhpExecutableFinder ;
4+ use Symfony \Component \Process \ProcessUtils ;
5+
6+ if (!function_exists ('call_in_background ' )) {
7+ function call_in_background ($ command , $ before = null , $ after = null )
8+ {
9+ $ parts = [];
10+ if (!empty ($ before )) {
11+ $ parts [] = $ before ;
12+ }
13+
14+ $ binary = ProcessUtils::escapeArgument ((new PhpExecutableFinder )->find (false ));
15+ if (defined ('HHVM_VERSION ' )) {
16+ $ binary .= ' --php ' ;
17+ }
18+ $ artisan = 'artisan ' ;
19+ if (defined ('ARTISAN_BINARY ' )) {
20+ $ artisan = ProcessUtils::escapeArgument (ARTISAN_BINARY );
21+ }
22+ $ parts [] = "{$ binary } {$ artisan } {$ command }" ;
23+
24+ if (!empty ($ after )) {
25+ $ parts [] = $ after ;
26+ }
27+
28+ $ expression = implode (' && ' , $ parts );
29+ exec ("( {$ expression }) > /dev/null 2>&1 & " );
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments