File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 5
5
using System . Net ;
6
6
using System . Runtime . InteropServices ;
7
7
using System . Security . Cryptography . X509Certificates ;
8
+ using System . Text ;
8
9
9
10
namespace k8s
10
11
{
@@ -537,13 +538,23 @@ public static ExecCredentialResponse ExecuteExternalCommand(ExternalExecution co
537
538
538
539
try
539
540
{
540
- var responseObject = KubernetesJson . Deserialize < ExecCredentialResponse > ( process . StandardOutput . ReadToEnd ( ) ) ;
541
+ var output = new StringBuilder ( ) ;
542
+ process . OutputDataReceived += ( _ , args ) =>
543
+ {
544
+ if ( args . Data != null )
545
+ {
546
+ output . Append ( args . Data ) ;
547
+ }
548
+ } ;
549
+ process . BeginOutputReadLine ( ) ;
541
550
542
551
if ( ! process . WaitForExit ( ( int ) ExecTimeout . TotalMilliseconds ) )
543
552
{
544
553
throw new KubeConfigException ( "external exec failed due to timeout" ) ;
545
554
}
546
555
556
+ var responseObject = KubernetesJson . Deserialize < ExecCredentialResponse > ( output . ToString ( ) ) ;
557
+
547
558
if ( responseObject == null || responseObject . ApiVersion != config . ApiVersion )
548
559
{
549
560
throw new KubeConfigException (
@@ -554,10 +565,8 @@ public static ExecCredentialResponse ExecuteExternalCommand(ExternalExecution co
554
565
{
555
566
return responseObject ;
556
567
}
557
- else
558
- {
559
- throw new KubeConfigException ( $ "external exec failed missing token or clientCertificateData field in plugin output") ;
560
- }
568
+
569
+ throw new KubeConfigException ( $ "external exec failed missing token or clientCertificateData field in plugin output") ;
561
570
}
562
571
catch ( JsonException ex )
563
572
{
You can’t perform that action at this time.
0 commit comments