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

cdk: Unable to get user input in a cdk program #25843

Closed
Qlub53 opened this issue Jun 4, 2023 · 5 comments
Closed

cdk: Unable to get user input in a cdk program #25843

Qlub53 opened this issue Jun 4, 2023 · 5 comments
Labels
bug This issue is a bug. effort/medium Medium work item – several days of effort needs-reproduction This issue needs reproduction. p2 package/tools Related to AWS CDK Tools or CLI

Comments

@Qlub53
Copy link

Qlub53 commented Jun 4, 2023

Describe the bug

Trying to get user input from stdin through readline always ends up with

Subprocess exited with error 13

Does cdk not allow user input from stdin by design?

Expected Behavior

cdk program accepts user input from stdin.

Current Behavior

Subprocess exited with error 13

Reproduction Steps

import readline from 'readline';
import { stdin as input, stdout as output } from 'process';

readline.createInterface({ input, output })
	.question(`Please put in your answer: `, answer => console.log(answer));

Put the above snippet anywhere in your cdk program. In my case, I put it before const app = new cdk.App();.
Then run cdk synth or cdk deploy.

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.69.0

Framework Version

No response

Node.js Version

16.8.0

OS

macOS 12.5

Language

Typescript

Language Version

4.6.3

Other information

No response

@Qlub53 Qlub53 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 4, 2023
@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Jun 4, 2023
@pahud
Copy link
Contributor

pahud commented Jun 5, 2023

Thank you for your report but unfortunate I can't reproduce this error in my environment.

@pahud pahud added p2 needs-reproduction This issue needs reproduction. effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jun 5, 2023
@peterwoodworth
Copy link
Contributor

And also why not use parameters?

@peterwoodworth peterwoodworth added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 6, 2023
@Qlub53
Copy link
Author

Qlub53 commented Jun 6, 2023

And also why not use parameters?

Because some decisions in my logic can only be made at runtime and should require human intervention.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 6, 2023
@Qlub53
Copy link
Author

Qlub53 commented Jun 6, 2023

Thank you for your report but unfortunate I can't reproduce this error in my environment.

Hi @pahud , later I figured that it's not a matter of stdin but await.
Reopened a new separate issue #25871

@Qlub53 Qlub53 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2023
@github-actions
Copy link

github-actions bot commented Jun 6, 2023

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

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. effort/medium Medium work item – several days of effort needs-reproduction This issue needs reproduction. p2 package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

No branches or pull requests

3 participants