Skip to content

Conversation

Timsonrobl
Copy link

In set command parameter value read from %~p* parameter extension needed to be quoted to avoid special characters (like &)from path breaking command.
Current implementation:

SET dp0=%~dp0 

evaluates to

SET dp0=D:\CODE\dir-name-with & amp\vite-project\node_modules\.bin\ 

passing all characters after & as shell command (and failing):

"amp\vite-project\node_modules\.bin\" is not recognized as an internal or external command, operable program or batch file. 

Quoting set command parameters seems to fix this issue completely.

References

Fixes #45
Closes #45

in set command parameter value read from %~p* parameter extension needed to be quoted to avoid special characters from path breaking command
@Timsonrobl Timsonrobl marked this pull request as draft March 28, 2021 03:11
@Timsonrobl
Copy link
Author

It seems snapshots need to be regenerated

@Timsonrobl
Copy link
Author

It seems tests still fail:

 PASS test/to-batch-syntax-tests.js 12 OK 19.984ms FAIL test/basic.js ✖ expect rejected Promise test/basic.js .resolve(fixtures, 'from.env') th.resolve(fixtures, 'from.env/a/b/c') 53 | return t.rejects(cmdShim(from, to), { code: /^(ENOTDIR|EEXIST)$/ }) | -----------^ t => { --- expected +++ actual @@ -1,3 +1,3 @@ Error: ENOENT: no such file or directory, open 'D:\CODE\cmd-shim\test\fixtures\from.env\a\b\c.ps1' { - "code": /^(ENOTDIR|EEXIST)$/, + "code": "ENOENT", } FAIL test/basic.js 1 failed of 30 154.481ms ✖ expect rejected Promise 🌈 SUMMARY RESULTS 🌈 FAIL test/basic.js 1 failed of 30 154.481ms ✖ expect rejected Promise Suites: 1 failed, 1 passed, 2 of 2 completed Asserts: 1 failed, 41 passed, of 42 Time: 3s ---------------------|----------|----------|----------|----------|-------------------| File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | ---------------------|----------|----------|----------|----------|-------------------| All files | 100 | 100 | 100 | 100 | | cmd-shim | 100 | 100 | 100 | 100 | | index.js | 100 | 100 | 100 | 100 | | cmd-shim/lib | 100 | 100 | 100 | 100 | | to-batch-syntax.js | 100 | 100 | 100 | 100 | | ---------------------|----------|----------|----------|----------|-------------------|

Any ideas why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant