Skip to content

Commit

Permalink
fix: exec hanging
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanJosipovic committed Apr 17, 2023
1 parent 6ce40c1 commit 8682335
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -557,13 +557,15 @@ public static ExecCredentialResponse ExecuteExternalCommand(ExternalExecution co
throw new KubeConfigException($"external exec failed due to: {ex.Message}");
}

var stdout = process.StandardOutput.ReadToEnd();
var stderr = process.StandardError.ReadToEnd();
if (string.IsNullOrWhiteSpace(stderr) == false)
var stderr = process.StandardError.ReadLine();

if (!string.IsNullOrWhiteSpace(stderr))
{
throw new KubeConfigException($"external exec failed due to: {stderr}");
}

var stdout = process.StandardOutput.ReadToEnd();

// Wait for a maximum of 5 seconds, if a response takes longer probably something went wrong...
process.WaitForExit(5);

Expand Down

0 comments on commit 8682335

Please sign in to comment.