Skip to content

Commit 728a1f0

Browse files
authored
Open generated file in editor - and misc (#3829)
* Remove commented out config.yml code. * Open generated file in editor * Update doxygen for startBrowser() * Update code comments
1 parent ee7d462 commit 728a1f0

File tree

4 files changed

+12
-22
lines changed

4 files changed

+12
-22
lines changed

.circleci/config.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,3 @@ workflows:
158158
- test_72_highest
159159
- test_71_sqlite
160160
- test_71_postgres
161-
# pre-steps:
162-
# - run:
163-
# name: install dockerize
164-
# command: wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && tar -C . -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
165-
# environment:
166-
# DOCKERIZE_VERSION: v0.3.0
167-
# - run:
168-
# name: Wait for db
169-
# command: ./dockerize -wait tcp://localhost:5432 -timeout 1m
170-

src/Commands/generate/Helper/OutputHandler.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace Drush\Commands\generate\Helper;
44

5+
use Consolidation\SiteProcess\Util\Escape;
56
use DrupalCodeGenerator\Helper\OutputHandler as BaseOutputHandler;
7+
use Drush\Drush;
68
use Symfony\Component\Console\Output\OutputInterface;
79
use Webmozart\PathUtil\Path;
810

@@ -26,13 +28,12 @@ public function printSummary(OutputInterface $output, array $dumped_files)
2628
$file = Path::join($directory, $file);
2729
}
2830

29-
// @todo fix this.
30-
if (false && defined('DRUPAL_ROOT') && $dumped_files) {
31-
// @todo Below code is forking new process well but current process is not shutting down fully.
31+
if (defined('DRUPAL_ROOT') && $dumped_files) {
3232
$exec = drush_get_editor();
33-
$exec = str_replace('%s', drush_escapeshellarg(Path::makeAbsolute($dumped_files[0], DRUPAL_ROOT)), $exec);
34-
$pipes = [];
35-
proc_close(proc_open($exec . ' 2> ' . drush_bit_bucket() . ' &', [], $pipes));
33+
$exec = str_replace('%s', Escape::shellArg(Path::makeAbsolute($dumped_files[0], DRUPAL_ROOT)), $exec);
34+
$process = Drush::process($exec);
35+
// Use start() in order to get an async fork.
36+
$process->start();
3637
}
3738
parent::printSummary($output, $dumped_files);
3839
}

src/Exec/ExecTrait.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ trait ExecTrait
99
/**
1010
* Starts a background browser/tab for the current site or a specified URL.
1111
*
12-
* Uses a non-blocking proc_open call, so Drush execution will continue.
12+
* Uses a non-blocking Process call, so Drush execution will continue.
1313
*
1414
* @param $uri
1515
* Optional URI or site path to open in browser. If omitted, or if a site path
@@ -18,8 +18,8 @@ trait ExecTrait
1818
* @param int $sleep
1919
* @param bool $port
2020
* @param bool $browser
21-
* @return bool TRUE if browser was opened, FALSE if browser was disabled by the user or a,
22-
* TRUE if browser was opened, FALSE if browser was disabled by the user or a,
21+
* @return bool
22+
* TRUE if browser was opened. FALSE if browser was disabled by the user or a
2323
* default browser could not be found.
2424
*/
2525
public function startBrowser($uri = null, $sleep = 0, $port = false, $browser = true)
@@ -72,7 +72,6 @@ public function startBrowser($uri = null, $sleep = 0, $port = false, $browser =
7272
}
7373
// @todo We implode because quoting is messing up the sleep.
7474
$process = Drush::process(implode(' ', array_merge($args, [$browser, $uri])));
75-
$process->setTty(true);
7675
$process->run();
7776
}
7877
return true;

src/Sql/SqlBase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public function query($query, $input_file = null, $result_file = '')
252252
/**
253253
* Execute a SQL query. Always execute regardless of simulate mode.
254254
*
255-
* If you don't want query to print during --debug then
255+
* If you don't want results to print during --debug then
256256
* provide a $result_file whose value can be drush_bit_bucket().
257257
*
258258
* @param string $query
@@ -302,7 +302,7 @@ public function alwaysQuery($query, $input_file = null, $result_file = '')
302302
$exec .= ' > '. Escape::shellArg($result_file);
303303
}
304304

305-
// In --verbose mode, drush_shell_exec() will show the call to mysql/psql/sqlite,
305+
// In --verbose mode, Process will show the call to mysql/psql/sqlite,
306306
// but the sql query itself is stored in a temp file and not displayed.
307307
// We show the query when --debug is used and this function created the temp file.
308308
$this->logQueryInDebugMode($query, $input_file_original);

0 commit comments

Comments
 (0)