WordPress.org

Make WordPress Core

Opened 3 months ago

#49491 new defect (bug)

Escape command arguments of env:cli before passing to docker-compose

Reported by: ocean90 Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.3
Component: Build/Test Tools Keywords: needs-patch
Focuses: Cc:

Description

npm run env:cli option update blogname "foo bar" currently fails with "Error: Too many positional arguments: bar". This is because "foo bar" isn't passed with the quotes to docker-compose.

> WordPress@5.4.0 env:cli /WordPress/wordpress-core
> node ./tools/local-env/scripts/docker.js run cli "option" "update" "blogname" "foo bar"

Error: Too many positional arguments: bar
child_process.js:660
    throw err;
    ^

Error: Command failed: docker-compose run cli option update blogname foo bar
    at checkExecSyncError (child_process.js:621:11)
    at execSync (child_process.js:657:15)
    at Object.<anonymous> (/WordPress/wordpress-core/tools/local-env/scripts/docker.js:6:1)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11 {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 32760,
  stdout: null,
  stderr: null
}

Maybe we can use something like https://www.npmjs.com/package/shell-quote?

Change History (0)

Note: See TracTickets for help on using tickets.