question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when piping async output to --stdin

See original GitHub issue

Hello,

Thanks for a very useful package. I stumbled upon a weird error when piping a schema from an async node script. I suspect the issue originates with getSchemaFromFileDescriptor.

I have no prior experience with stdin, but, outside of keeping your code synchronous, is there a reason you didn’t use stdin.on('data') and stdin.on('end') events to build the schema string?

To Reproduce

  1. test.js:
setTimeout(() => {
  console.log(`
type Starship {
  id: ID!
  name: String!
}

type Query {
  starship: Starship
}
  `)
}, 1000)

  1. Run node test.js | graphql-schema-linter --stdin
  2. Error:
The --stdin option was specified, but not schema was provided via stdin.
No valid schema input.

Expected behaviour

Expected it to validate the schema.

Additional context

I’m using graphql-import@beta to import multiple types from a schema generated by openapi-to-graphql. I am redeclaring some types from there, so I cannot run the linter against them, as duplicate definition errors will show up.

I think it’s also a better method than requiring graphql-schema-linter to support all schema extensions (i.e. #147, #155)

graphql-import@beta became async and now my pipe to graphql-schema-linter --stdin fails.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
cjoudreycommented, Apr 14, 2020

Should be fixed in v0.2.6. Thanks again @dnerdy.

0reactions
dnerdycommented, Apr 13, 2020

We’ve seen an uptick in this issue recently, so I’ve gone ahead and created a PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rust async (?) stdin read from pipe - Stack Overflow
I would like to implement a async stdin function for otherwise sync cli application. I would like to take output from program A...
Read more >
Cannot run any command with piped stdin with Nightly toolchain
I cannot spawn any tokio::process::Comand with a piped stdin in the Nightly toolchain. ... I did not expect any output because it's being...
Read more >
Semi-asynchronous pipe - bash - Unix Stack Exchange
SIGPIPE : The PIPE signal is sent to a process when it attempts to write to a pipe without a process connected to...
Read more >
Running a Child Process with Standard Input and Output
Running a child process using Process (or NSTask in Objective-C) is easy, but piping data to and from the child's stdin and stdout...
Read more >
Subprocesses — Python 3.11.1 documentation
import asyncio async def run(cmd): proc = await asyncio.create_subprocess_shell( cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE) stdout ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found