diff --git a/README.md b/README.md index cdccd13..e1838a5 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ const result = spawnSync('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit const { spawn, spawnSync } = require('cross-spawn'); ``` +TypeScript types are included, so `@types/cross-spawn` isn't needed. + ## Caveats @@ -110,7 +112,7 @@ npm test npm run typecheck # During development, in watch mode -node --disable-warning=DEP0190 --test --watch "test/*.test.js" "src/**/*.test.js" +node --test --watch "test/*.test.js" "src/**/*.test.js" ``` diff --git a/src/parse.js b/src/parse.js index 1c6b892..0a4bbbb 100644 --- a/src/parse.js +++ b/src/parse.js @@ -60,8 +60,9 @@ function parseNonShell(parsed) { // If a shell is required, use cmd.exe and take care of escaping everything correctly // Note that `forceShell` is an hidden option used only in tests if (parsed.options.forceShell || needsShell) { - // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar) - // This is necessary otherwise it will always fail with ENOENT in those cases + // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar), as cmd.exe expects `\` as the path + // separator and might otherwise not find the command + // Batch files don't need it, as they are run by their resolved path below parsed.command = path.normalize(parsed.command); // Arguments can't contain values that can't be escaped for cmd.exe either, e.g. line breaks