Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. func main() {
  2.  
  3. cmd := exec.Command("sh", "-c", "mongo --quiet --host=localhost test")
  4. f, _ := pty.Start(cmd)
  5. cmd.Start()
  6.  
  7. time.Sleep(1 * time.Second) // some time to start
  8.  
  9. for ;; {
  10.  
  11. io.WriteString(f, "sleep(1000);Date.now();n")
  12. stdoutScanner := bufio.NewScanner(f)
  13.  
  14. go func() {
  15. for stdoutScanner.Scan() {
  16. text := stdoutScanner.Text()
  17. println(text)
  18. }
  19. }()
  20.  
  21. time.Sleep(1200 * time.Millisecond)
  22. }
  23. }
  24.  
  25. > sleep(1000);Date.now();sleep(1000);Date.now();
  26. 1559185677551
  27. sleep(1000);Date.now();
  28. 1559185679053
  29. 1559185691069
  30. now();
  31. 1559185692573
  32. );Date.now();sleep(1000);Date.now();
  33. 1559185694074
  34. ep(1000);Date.now();sleep(1000);Date.now();
  35.  
  36. 1559185677551
  37. 1559185679053
  38. 1559185691069
  39. 1559185692573
  40. 1559185694074
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement