Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func main() {
- cmd := exec.Command("sh", "-c", "mongo --quiet --host=localhost test")
- f, _ := pty.Start(cmd)
- cmd.Start()
- time.Sleep(1 * time.Second) // some time to start
- for ;; {
- io.WriteString(f, "sleep(1000);Date.now();n")
- stdoutScanner := bufio.NewScanner(f)
- go func() {
- for stdoutScanner.Scan() {
- text := stdoutScanner.Text()
- println(text)
- }
- }()
- time.Sleep(1200 * time.Millisecond)
- }
- }
- > sleep(1000);Date.now();sleep(1000);Date.now();
- 1559185677551
- sleep(1000);Date.now();
- 1559185679053
- 1559185691069
- now();
- 1559185692573
- );Date.now();sleep(1000);Date.now();
- 1559185694074
- ep(1000);Date.now();sleep(1000);Date.now();
- 1559185677551
- 1559185679053
- 1559185691069
- 1559185692573
- 1559185694074
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement