Open waitingkuo opened 8 years ago
@waitingkuo ah that's nasty. That sounds a bit like the known issue we got at https://godoc.org/github.com/ahmetalpbalkan/go-dexec#hdr-Known_issues
- You may receive empty stdout/stderr from commands if the executed command does not end with a trailing new line or has a different flushing behavior.
Can you try appending an empty line echo
after that? (echo $(pwd);echo
)
@ahmetalpbalkan it's still the same. Sometimes it can output correctly, sometimes empty.
@waitingkuo yep that flakiness actually is my experience with running fast commands as well while I developed this. It appears like there is either a flushing bug in the go-dockerclient
's hijack protocol implementation I am using or in the docker engine. (Former is more likely.)
When you run slower commands (or add sleep
s it is actually working fine). What I can suggest is, try using https://godoc.org/github.com/fsouza/go-dockerclient directly (you can take a look at dexec source code and see how we call into that library) and repro it with the go-dockerclient only, and open an issue on its repository.
That would fix the downstream.
@fsouza any ideas? Have you heard of any missing output cases from go-dockerclient attach/hijack functionality?
@ahmetalpbalkan I haven't, but I can help debugging it. I'll try to reproduce it using only go-dockerclient.
I wanna run
sh -c "echo $(pwd)"
.cmd is executed by
dexec
, but it doesn't output anything. cmd2 is executed by go's built-inexec
, it works.