You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a timeout of 1s to the 'podman version' command
This command is called at dependency injection time to initialize a (nil-able) Podman client,
even if users won't use Podman at all.
As discussed, this command is supposed to be
quite fast to return, hence this timeout of 1 second.
Initially, we were using cmd.Output to get the command output,
but as reported in [1], cmd.Output does not respect the context timeout.
This explains the workaround of reading from both stdout and stderr pipes,
*and* relying on cmd.Wait() to close those pipes properly when the program exits
(either as expected or when the timeout is reached).
[1] golang/go#57129
Co-authored-by: Philippe Martin <[email protected]>
// Because Version is used at the very beginning of odo, when resolving and injecting dependencies (for commands that might require the Podman client),
33
+
// it is expected to return in a timely manny (hence this timeout of 1 second).
34
+
// This is to avoid situations like the one described in https://github.com/redhat-developer/odo/issues/6575
35
+
// (where a podman that takes too long to respond affects the "odo dev" command, even if the user did not intend to use the Podman platform).
0 commit comments