@@ -100,19 +100,23 @@ func TestKeystoreRemoveMultipleExistingKeys(t *testing.T) {
100
100
mockbeat .Stop ()
101
101
102
102
mockbeat .Start ("keystore" , "add" , "key1" , "--stdin" )
103
- fmt .Fprintf (os .Stdin , "pass1" )
103
+
104
+ fmt .Fprintf (mockbeat .stdin , "pass1" )
105
+ require .NoError (t , mockbeat .stdin .Close (), "could not close mockbeat stdin" )
104
106
procState , err := mockbeat .Process .Wait ()
105
107
require .NoError (t , err )
106
108
require .Equal (t , 0 , procState .ExitCode (), "incorrect exit code" )
107
109
108
110
mockbeat .Start ("keystore" , "add" , "key2" , "--stdin" )
109
- fmt .Fprintf (os .Stdin , "pass2" )
111
+ fmt .Fprintf (mockbeat .stdin , "pass2" )
112
+ require .NoError (t , mockbeat .stdin .Close (), "could not close mockbeat stdin" )
110
113
procState , err = mockbeat .Process .Wait ()
111
114
require .NoError (t , err )
112
115
require .Equal (t , 0 , procState .ExitCode (), "incorrect exit code" )
113
116
114
117
mockbeat .Start ("keystore" , "add" , "key3" , "--stdin" )
115
- fmt .Fprintf (os .Stdin , "pass3" )
118
+ fmt .Fprintf (mockbeat .stdin , "pass3" )
119
+ require .NoError (t , mockbeat .stdin .Close (), "could not close mockbeat stdin" )
116
120
procState , err = mockbeat .Process .Wait ()
117
121
require .NoError (t , err )
118
122
require .Equal (t , 0 , procState .ExitCode (), "incorrect exit code" )
0 commit comments