Created
December 13, 2017 16:10
-
-
Save superherointj/4dbe58b4ffdeff53737308f46f4fcc97 to your computer and use it in GitHub Desktop.
App for testing Merlin protocol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The goal here is to print Merlin version 3 times. To test sync/async support. | |
const { spawn } = require("child_process"); | |
const mp = spawn("ocamlmerlin"); | |
let i = 0; | |
mp.stdin.write('["protocol","version"]'); | |
mp.stdout.on("data", data => { | |
console.log(`stdout: -----START -----\n${data}---------------------`); | |
if (i < 2) { | |
mp.stdin.write('["protocol","version"]'); | |
i++; | |
} | |
}); | |
mp.stderr.on("data", data => { | |
console.log(`stderr: ${data}`); | |
}); | |
mp.on("close", code => { | |
console.log(`child process exited with code ${code}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment