What model of Go are you utilizing (go model
)?
1.18.2
Does this situation reproduce with the most recent launch?
package deal essential
import (
"fmt"
"io"
"log"
"os/exec"
"os"
)
func essential() {
command :="openconnect"
param := []string{"https://192.168.0.100:1443","-u","check","--passwd-on-stdin"}
cmd :=exec.Command(command,param...)
stdin, err := cmd.StdinPipe()
if err != nil {
log.Deadly(err)
}
go func() {
defer stdin.Shut()
io.WriteString(stdin, "123n")
}()
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err = cmd.Begin(); err != nil { //Use begin, not run
fmt.Println("An error occured: ", err) //change with logger, or something you need
}
cmd.Wait()
}
What working system and processor structure are you utilizing (go env
)?
home windows
What did you do?
I encountered the identical drawback. My code is principally the identical because the creator’s.
- For command applications written in golang, stdinpipe can work usually.
- BeamMP-Server.exe, stdinpipe doesn’t work correctly, but when I begin it manually, I can enter instructions usually.
https://beammp.com/
Obtain server
What did you count on to see?
stdinpipe work usually for BeamMP-Server.exe program.
What did you see as an alternative?
- no error
- command no work
- program stdout didn’t print all the things