Let prettier --stdin work with keyboard input (#2147)
This uses [get-stream] instead of [get-stdin], since the latter just gives an empty string if process.stdin is a TTY (see https://github.com/sindresorhus/get-stdin/issues/21) [get-stream]: https://github.com/sindresorhus/get-stream [get-stdin]: https://github.com/sindresorhus/get-stdin
This commit is contained in:
1 parent
3bbfa97152
commit
cb44125a21
3 files changed
+6
-6
No files matched your search
+2
-2
@@ -4,7 +4,7 @@
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const getStdin = require("get-stdin");
|
||||
const getStream = require("get-stream");
|
||||
const glob = require("glob");
|
||||
const chalk = require("chalk");
|
||||
const minimist = require("minimist");
|
||||
@@ -252,7 +252,7 @@ if (argv["help"] || (!filepatterns.length && !stdin)) {
|
||||
}
|
||||
|
||||
if (stdin) {
|
||||
getStdin().then(input => {
|
||||
getStream(process.stdin).then(input => {
|
||||
try {
|
||||
writeOutput(format(input, options));
|
||||
} catch (e) {
|
||||
|
||||
Reference in new issue
Block a user