Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: cdk init fails if run under a directory where cdk.json exists #5826

Closed
rix0rrr opened this issue Jan 16, 2020 · 5 comments
Closed

CLI: cdk init fails if run under a directory where cdk.json exists #5826

rix0rrr opened this issue Jan 16, 2020 · 5 comments
Assignees
Labels
bug This issue is a bug. p0 package/tools Related to AWS CDK Tools or CLI

Comments

@rix0rrr
Copy link
Contributor

rix0rrr commented Jan 16, 2020

I have a messy ~/Temp directory where I try out all kinds of things.

It so happens that ~/Temp/cdk.json exists, but what happens since #5772 is that I can't run cdk init anymore anywhere under ~/Temp, which I do all the time:

huijbers ~/Temp> cd cdk-java-app/
huijbers ~/T/cdk-java-app> cdk init --language=java
'cdk init' cannot be run in a non-empty directory!

Well the directory is empty! I just made it!

Turns out that the CLI chdir()s to ~/Temp before cdk init is run, but it's super hard for me to figure that out.

Can I suggest that the magic chdir behavior only happens when applicable to an existing CDK app, for commands like synth and deploy etc?


This is 🐛 Bug Report

@rix0rrr rix0rrr added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. package/tools Related to AWS CDK Tools or CLI labels Jan 16, 2020
@eladb
Copy link
Contributor

eladb commented Jan 16, 2020

Two days ago, @eladb said: "Eli, don't worry about the case where someone has a cdk.json file in /tmp, it's such a fringy case..."

@iliapolo
Copy link
Contributor

@eladb Famous last words strikes again...

@iliapolo iliapolo added the p0 label Jan 16, 2020
@rix0rrr
Copy link
Contributor Author

rix0rrr commented Jan 16, 2020

I would argue this is not really a p0 though.

@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Jan 17, 2020
@jialechan
Copy link
Contributor

cdk init sample-app --language=java
work for me

@iliapolo
Copy link
Contributor

I am closing this issue since the feature that caused this bug was reverted in version 1.21.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p0 package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

No branches or pull requests

5 participants