UNPKG

445 BJavaScriptView Raw
1const fs = require('fs')
2
3function stdinStreamProcessor (exercise) {
4 exercise.addProcessor(function (mode, callback) {
5 fs.createReadStream(this.inputFilePath).pipe(this.submissionChild.stdin)
6 if (mode === 'verify') {
7 fs.createReadStream(this.inputFilePath).pipe(this.solutionChild.stdin)
8 }
9
10 process.nextTick(function () {
11 callback(null, true)
12 })
13 })
14
15 return exercise
16}
17
18module.exports = stdinStreamProcessor