@@ -146,6 +146,18 @@ func TestLogout(t *testing.T) {
146
146
err = os .Chmod (string (config ), 0500 )
147
147
require .NoError (t , err )
148
148
}
149
+ t .Cleanup (func () {
150
+ // Setting the permissions back for cleanup.
151
+ if runtime .GOOS == "windows" {
152
+ err = os .Chmod (string (config .URL ()), 0600 )
153
+ require .NoError (t , err )
154
+ err = os .Chmod (string (config .Session ()), 0600 )
155
+ require .NoError (t , err )
156
+ } else {
157
+ err = os .Chmod (string (config ), 0700 )
158
+ require .NoError (t , err )
159
+ }
160
+ })
149
161
150
162
logoutChan := make (chan struct {})
151
163
logout , _ := clitest .New (t , "logout" , "--global-config" , string (config ))
@@ -164,19 +176,6 @@ func TestLogout(t *testing.T) {
164
176
pty .ExpectMatch ("Are you sure you want to logout?" )
165
177
pty .WriteLine ("yes" )
166
178
<- logoutChan
167
-
168
- t .Cleanup (func () {
169
- // Setting the permissions back for cleanup.
170
- if runtime .GOOS == "windows" {
171
- err = os .Chmod (string (config .URL ()), 0600 )
172
- require .NoError (t , err )
173
- err = os .Chmod (string (config .Session ()), 0600 )
174
- require .NoError (t , err )
175
- } else {
176
- err = os .Chmod (string (config ), 0700 )
177
- require .NoError (t , err )
178
- }
179
- })
180
179
})
181
180
}
182
181
0 commit comments