From dd62845f094117dd70f5918ceeeb27005b610853 Mon Sep 17 00:00:00 2001 From: Jacky Wang Date: Sun, 12 Jul 2020 21:42:51 -0700 Subject: [PATCH] [node.sh] fix a race condition in bls loader test --- cmd/harmony/blsloader/kms.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/harmony/blsloader/kms.go b/cmd/harmony/blsloader/kms.go index 149ac2cbc..48f4303bd 100644 --- a/cmd/harmony/blsloader/kms.go +++ b/cmd/harmony/blsloader/kms.go @@ -226,8 +226,9 @@ func (provider *promptACProvider) prompt(hint string) (string, error) { timedOut = time.After(provider.timeout) ) + cs := console go func() { - res, err = provider.threadedPrompt(hint) + res, err = provider.threadedPrompt(cs, hint) close(finished) }() @@ -241,9 +242,9 @@ func (provider *promptACProvider) prompt(hint string) (string, error) { } } -func (provider *promptACProvider) threadedPrompt(hint string) (string, error) { - console.print(hint) - return console.readPassword() +func (provider *promptACProvider) threadedPrompt(cs consoleItf, hint string) (string, error) { + cs.print(hint) + return cs.readPassword() } func kmsClientWithConfig(config *AwsConfig) (*kms.KMS, error) {