Skip to content

Commit 342eea9

Browse files
committed
Move login command inside try so we clear env correctly
1 parent d3facba commit 342eea9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Diff for: repo2docker/docker.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -190,19 +190,19 @@ def docker_login(self, username, password, registry):
190190
shutil.copy2(dc_path, new_dc_path)
191191

192192
os.environ["DOCKER_CONFIG"] = d
193-
proc = subprocess.run(
194-
[
195-
"docker",
196-
"login",
197-
"--username",
198-
username,
199-
"--password-stdin",
200-
registry,
201-
],
202-
input=password.encode(),
203-
check=True,
204-
)
205193
try:
194+
subprocess.run(
195+
[
196+
"docker",
197+
"login",
198+
"--username",
199+
username,
200+
"--password-stdin",
201+
registry,
202+
],
203+
input=password.encode(),
204+
check=True,
205+
)
206206
yield
207207
finally:
208208
if old_dc_path:

0 commit comments

Comments
 (0)