Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should I be accessing this.(submission|solution)Child.stdin directly? #8

Open
joshuakfarrar opened this issue Mar 28, 2014 · 0 comments

Comments

@joshuakfarrar
Copy link

Is this appropriate? I see that if you want to hook into Stdout of a child, you can access exercise.(submission|solution)Stdout, and that the exercise class has a method for getStdout.. Is there a better way to handle the IOs of child processes?

function query (mode) {
  var exercise = this

  function send (stream) {
    var input = through2()
    input
      .pipe(stream)
      .on('error', function(err) {
        exercise.emit(
          'fail',
          'Submission never read from process.stdin'
        )
      })
    input.write('secret message');
    input.end();
  }

  send(exercise.submissionChild.stdin)

  if (mode == 'verify')
    send(exercise.solutionChild.stdin)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant