Closed rhoughton-pivot closed 4 years ago
Noticing the same behavior. It's not limited or specific to ipconfig
.
Basically any command sent exhibits the same behavior.
go version go1.14 darwin/amd64
Have tried on darwin and linux (via a Docker container) with the same results.
Tested using example from the README:
client.RunWithInput("ipconfig", os.Stdout, os.Stderr, os.Stdin)
Read through some of the tests and tried a modified version based on the test config.
The below worked, which indicates that I didn't understand the meaning of the input. My fault there.
Posting this for anyone else who comes across it.
client.RunWithInput("ipconfig", os.Stdout, os.Stderr, strings.NewReader("this is the input"))
Hi @atxviking,
I'm not sure I understand what you meant. Do you mean you were able to make it not block waiting for input?
The original report was about the winrm-cli
command that was stuck.
Indeed winrm-cli
tries to read os.Stdin
. Theoritically the shell shouldn't give anything to read to the process, but I think it is possible that the code blocks while waiting for os.Stdin
to give some bytes that don't exist.
In which case something like:
echo | ./winrm ...
should work and not block.
BTW, @rhoughton-pivot , can you give me a bit more information about the running context (like OS, shell, go version etc).
You should be able to build it yourself:
Working, non-blocking dockerfile using a pinned SHA to build locally Non-working, blocking dockerfile from before we pinned
Hi, I believe I fixed the issue in the latest winrm-cli version (see masterzen/winrm-cli#9). It's what I thought, winrm-cli was always telling winrm to wait for stdin. But when the command is run from a terminal, then there's nothing to wait for.
Please @rhoughton-pivot and @atxviking , can you check the problem is fixed for your use cases?
Thanks,
Thanks for looking into this. Working on my end.
Thanks for the fix. Works for us as well.
Since the change to go-modules, winrm-cli does not return when issuing commands to remote Windows machines. Following the sample command on the
winrm-cli
README yields expectedipconfig /all
results, but then hangs as though expecting more output.