Guest User

Untitled

a guest
Dec 16th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. // The goal here is to print Merlin version 3 times. To test sync/async support.
  2.  
  3. const { spawn } = require("child_process");
  4.  
  5. const mp = spawn("ocamlmerlin");
  6.  
  7. let i = 0;
  8.  
  9. mp.stdin.write('["protocol","version"]');
  10.  
  11. mp.stdout.on("data", data => {
  12. console.log(`stdout: -----START -----\n${data}---------------------`);
  13. if (i < 2) {
  14. mp.stdin.write('["protocol","version"]');
  15. i++;
  16. }
  17. });
  18. mp.stderr.on("data", data => {
  19. console.log(`stderr: ${data}`);
  20. });
  21. mp.on("close", code => {
  22. console.log(`child process exited with code ${code}`);
  23. });
Add Comment
Please, Sign In to add comment