Skip to content

Commit

Permalink
fix: use Cmd instead of RawCmd to execute composer and put vendor/bin…
Browse files Browse the repository at this point in the history
… first in PATH, fixes ddev#6602 (ddev#6604) [skip ci]
  • Loading branch information
rfay authored Oct 10, 2024
1 parent 9ab9078 commit 44c6293
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# If not running interactively, don't do anything
[ -z "$PS1" ] && return

export PATH="${DDEV_COMPOSER_ROOT:-/var/www/html}/vendor/bin:${PATH}"

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# This file is loaded in non-interactive bash shells through $BASH_ENV
export PATH="${DDEV_COMPOSER_ROOT:-/var/www/html}/vendor/bin:${PATH}"
for f in /etc/bashrc/*.bashrc; do
source $f;
done
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export PATH="~/bin:$PATH:/var/www/html/vendor/bin:/var/www/html/bin:$DDEV_COMPOSER_ROOT/vendor/bin"
export PATH="~/bin:$PATH:/var/www/html/bin"

[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && source "$NVM_DIR/bash_completion"
Expand Down
4 changes: 3 additions & 1 deletion pkg/ddevapp/composer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"os"
"runtime"
"strings"

"github.com/ddev/ddev/pkg/fileutil"
"github.com/mattn/go-isatty"
Expand All @@ -17,10 +18,11 @@ func (app *DdevApp) Composer(args []string) (string, string, error) {
return "", "", fmt.Errorf("failed to process pre-composer hooks: %v", err)
}

argString := strings.Join(args, " ")
stdout, stderr, err := app.Exec(&ExecOpts{
Service: "web",
Dir: app.GetComposerRoot(true, true),
RawCmd: append([]string{"composer"}, args...),
Cmd: "composer " + argString,
Tty: isatty.IsTerminal(os.Stdin.Fd()),
// Prevent Composer from debugging when Xdebug is enabled
Env: []string{"XDEBUG_MODE=off"},
Expand Down
2 changes: 1 addition & 1 deletion pkg/versionconstants/versionconstants.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var AmplitudeAPIKey = ""
var WebImg = "ddev/ddev-webserver"

// WebTag defines the default web image tag
var WebTag = "20241002_deviantintegral_vim_tiny" // Note that this can be overridden by make
var WebTag = "20241009_use_cmd_composer" // Note that this can be overridden by make

// DBImg defines the default db image used for applications.
var DBImg = "ddev/ddev-dbserver"
Expand Down

0 comments on commit 44c6293

Please sign in to comment.