How can I run a binary file in my golang program and keep interacting with it by sending some input and waiting for the output? In what I did, I run it only once. And I want to keep this binary file running and interact with it, I don't want to run it multiple times.
package main
import (
"os/exec"
"bytes"
"fmt"
)
func main() {
command := exec.Command("./program")
var output bytes.Buffer
command.Stdout = &output
command.Run()
result := output.String()
IV := result[:4]
cipher := result[5:]
cipher = cipher[:len(cipher)-1]
fmt.Printf("%v", result)
fmt.Printf("%v", IV)
fmt.Printf("%v", cipher)
}