Skip to content

codegen generate --watch breaks when used with concurrency  #541

@mohsen1

Description

@mohsen1

When I use codegen generate --watch in a concurrency sequence I get this error:

TypeError: process.stdin.setRawMode is not a function

I think the watch mode should not exit on keypress and instead it should exit on common interrupts like ^C

Bug Repository

https://github.com/mohsen1/apollo-codegen-generate-watch-bug

CLI Output

 npm start                                                                                                                                                                                                                                                                                                        

> apollo-react@0.1.0 start /Users/mohsen_nabiloo-azimi/Desktop/apollo-react
> concurrently 'npm run start-dev' 'npm run generate-types -- --watch'

[1]
[1] > apollo-react@0.1.0 generate-types /Users/mohsen_nabiloo-azimi/Desktop/apollo-react
[1] > apollo codegen:generate --schema=api-schema.json  --target=typescript --queries='**/*.tsx' "--watch"
[1]
[0]
[0] > apollo-react@0.1.0 start-dev /Users/mohsen_nabiloo-azimi/Desktop/apollo-react
[0] > react-scripts-ts start
[0]
[1] [10:27:39] Loading Apollo config [started]
[1] [10:27:39] Loading Apollo config [completed]
[1] [10:27:39] Resolving GraphQL document sets and dependencies [started]
[0] Starting type checking and linting service...
[0] Using 1 worker with 2048MB memory limit
[0] Watching: /Users/mohsen_nabiloo-azimi/Desktop/apollo-react/src
[1] [10:27:40] Scanning for GraphQL queries (20 found) [title changed]
[1] [10:27:40] Scanning for GraphQL queries (20 found) [completed]
[1] [10:27:40] Generating query files [started]
[1] [10:27:40] Generating query files with 'typescript' target [title changed]
[1] [10:27:40] Generating query files with 'typescript' target - wrote 0 files [title changed]
[1] [10:27:40] Generating query files with 'typescript' target - wrote 0 files [completed]
Starting the development server...
[0]
[0] ts-loader: Using typescript@3.0.1 and /Users/mohsen_nabiloo-azimi/Desktop/apollo-react/tsconfig.json
[1] Press any key to stop.
[1] TypeError: process.stdin.setRawMode is not a function
[1]     at waitForKey (~/Desktop/apollo-react/node_modules/apollo/lib/commands/codegen/generate.js:14:19)
[1]     at Generate.run (~/Desktop/apollo-react/node_modules/apollo/lib/commands/codegen/generate.js:123:19)
[1]     at <anonymous>
[1] npm ERR! code ELIFECYCLE
npm ERR! errno 1
[1] npm ERR! apollo-react@0.1.0 generate-types: `apollo codegen:generate --schema=api-schema.json  --target=typescript --queries='**/*.tsx' "--watch"`
[1] npm ERR! Exit status 1
[1] npm ERR!
npm ERR! Failed at the apollo-react@0.1.0 generate-types script.
[1] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[1]
[1] npm ERR! A complete log of this run can be found in:
[1] npm ERR!     /Users/mohsen_nabiloo-azimi/.npm/_logs/2018-08-09T17_27_42_043Z-debug.log
[1] npm run generate-types -- --watch exited with code 1
[0] Compiled successfully!
[0]
[0] You can now view apollo-react in the browser.
[0]
[0]   Local:            http://localhost:3000/
[0]   On Your Network:  http://10.1.131.106:3000/
[0]
[0] Note that the development build is not optimized.
[0] To create a production build, use yarn build.
[0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions