From 462670fac9d14e1a7ccde2570f018ba30dad8fc4 Mon Sep 17 00:00:00 2001 From: Laurence de Bruxelles <laurence.debruxelles@digital.cabinet-office.gov.uk> Date: Tue, 6 Dec 2022 17:25:02 +0000 Subject: [PATCH] Fix crashes when path to prototype contains spaces We had a user unable to use the migration script because the path to their prototype included spaces. Fix this by not `spawn`ing via the shell in `bin/cli`; we don't need to, and this way we don't need to worry about escaping command line arguments. --- CHANGELOG.md | 4 ++++ bin/cli | 2 -- bin/utils/index.js | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ccb5b68bb..4c6f166df4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Fixes + +- [Fix crashes when path to prototype contains spaces](https://github.com/alphagov/govuk-prototype-kit/pull/1841) + ## 13.0.1 ### Fixes diff --git a/bin/cli b/bin/cli index 3719cac4ab..46215920ad 100755 --- a/bin/cli +++ b/bin/cli @@ -153,7 +153,6 @@ function warnIfNpmStart (argv, env) { await spawn('npx', ['govuk-prototype-kit', 'init', '--', installDirectory], { cwd: installDirectory, - shell: true, stdio: 'inherit' }) } else if (argv.command === 'init') { @@ -212,7 +211,6 @@ function warnIfNpmStart (argv, env) { await prepareMigration(kitDependency, projectDirectory) await spawn('npx', ['govuk-prototype-kit', 'migrate', '--', projectDirectory], { - shell: true, stdio: 'inherit' }) } else { diff --git a/bin/utils/index.js b/bin/utils/index.js index 447bf3554e..b463eb553b 100644 --- a/bin/utils/index.js +++ b/bin/utils/index.js @@ -13,7 +13,6 @@ async function npmInstall (cwd, dependencies) { ...dependencies ], { cwd: cwd, - shell: true, stdio: 'inherit' }) }