Skip to content

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

Merged
shadaj merged 1 commit intoapollographql:masterfrom
trojanowski:watch-on-no-tty
Aug 10, 2018
Merged

Allow to run apollo codegen:generate --watch on non tty devices#534
shadaj merged 1 commit intoapollographql:masterfrom
trojanowski:watch-on-no-tty

Conversation

@trojanowski
Copy link
Copy Markdown
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
Copy Markdown

@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
Copy Markdown
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