aws-cdk-cli: CDK fails if node executable has a space in the path #28582
Labels
@aws-cdk/core
Related to core CDK functionality
bug
This issue is a bug.
cli
Issues related to the CDK CLI
effort/medium
Medium work item – several days of effort
p2
package/tools
Related to AWS CDK Tools or CLI
Describe the bug
The CDK fails to execute any command that uses a sub-process when the node executable has a space in its path. The error is non-obvious as to the cause.
Expected Behavior
The CDK commands should work the same whether or not the node executable has a space in its path.
Current Behavior
A seemingly random error occurs running cdk commands:
Reproduction Steps
On MacOS I use FNM as my node module and this was my node path:
Possible Solution
This seems to be caused by the line where the
commandLine params are joined
:I monkey-patched my local CDK install to quote values which have a space in them:
Tip
it's worth noting that the
exec.js
may not be the file to fix this in - I needed to modifyindex.js
insteadwhich allowed all my CDK commands to execute successfully and without errors.
Additional Information/Context
This took me a while to debug because I had no context as to what sub-process was failing. Immediately above the line there is some logging of the environment in debug mode - I'd suggest also emitting the path to the command line as well before calling
exec
; that would have at least alerted me to the fact that it was a node problem.CDK CLI Version
2.32.1 (build 79cbe95)
Framework Version
No response
Node.js Version
v18.18.2
OS
MacOS
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: