Skip to content

Commit 457225b

Browse files
trojanowskishadaj
authored andcommitted
Allow to run apollo codegen:generate --watch on no tty devices (#534)
1 parent f922ee1 commit 457225b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

packages/apollo-cli/src/commands/codegen/generate.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import "apollo-codegen-core/lib/polyfills";
22
import { Command, flags } from "@oclif/command";
33
import * as Listr from "listr";
44
import * as path from "path";
5+
import * as tty from "tty";
56

67
import { TargetType, default as generate } from "../../generate";
78

@@ -245,8 +246,10 @@ export default class Generate extends Command {
245246
console.log("\nChange detected, generating types...");
246247
tasks.run().catch(() => {});
247248
});
248-
await waitForKey();
249-
watcher.close();
249+
if (tty.isatty((process.stdin as any).fd)) {
250+
await waitForKey();
251+
watcher.close();
252+
}
250253
return;
251254
} else {
252255
return tasks.run();

0 commit comments

Comments
 (0)