Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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}`);
- });
Add Comment
Please, Sign In to add comment