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

Allow to run apollo codegen:generate --watch on non tty devices #534

Merged
merged 1 commit into from
Aug 10, 2018

Conversation

trojanowski
Copy link
Contributor

@trojanowski trojanowski commented Aug 7, 2018

Currently it's not possible to use the --watch options if the stdin is not a tty (e. g. if the command is run using the concurrently cli tool). You can reproduce this bug with the following command:

apollo codegen:generate --target=typescript --schema=src/data/schema.json '--queries=src/**/*.tsx' --watch < /dev/null

You'll see the following output:

 ✔ Loading Apollo config
 ✔ Scanning for GraphQL queries (6 found)
 ✔ Generating query files with 'typescript' target - wrote 3 files
Press any key to stop.
TypeError: process.stdin.setRawMode is not a function
    at waitForKey (~/Projects/omnicalc/node_modules/apollo/lib/commands/codegen/generate.js:17:19)
    at Generate.run (~/Projects/omnicalc/node_modules/apollo/lib/commands/codegen/generate.js:127:23)
    at <anonymous>

This PR fixes the problem.

@apollo-cla
Copy link

@trojanowski: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

Copy link
Contributor

@shadaj shadaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@shadaj shadaj merged commit 457225b into apollographql:master Aug 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants