Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to shell command #111

Merged
merged 3 commits into from
Jan 10, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions inc/composer/class-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ protected function start( InputInterface $input, OutputInterface $output ) {

// Check install was successful.
if ( $install_failed ) {
$output->writeln( '<error>WordPress install failed.</>' );
$output->writeln( sprintf( '<error>WordPress install failed. Exited with error code %d</>', $install_failed ) );
return $install_failed;
}

Expand Down Expand Up @@ -312,11 +312,15 @@ protected function logs( InputInterface $input, OutputInterface $output ) {
}

protected function shell( InputInterface $input, OutputInterface $output ) {
$columns = exec( 'tput cols' );
$lines = exec( 'tput lines' );
passthru( sprintf(
'cd %s; VOLUME=%s COMPOSE_PROJECT_NAME=%s docker-compose exec php /bin/bash',
'cd %s; VOLUME=%s COMPOSE_PROJECT_NAME=%s docker-compose exec -e COLUMNS=%d -e LINES=%d -u root php /bin/bash',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the -u root and instead make that an additional cli argument 🙏

'vendor/altis/local-server/docker',
getcwd(),
$this->get_project_subdomain()
escapeshellarg( getcwd() ),
$this->get_project_subdomain(),
$columns,
$lines
), $return_val );

return $return_val;
Expand Down