Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
Support running local-cname on containers
Browse files Browse the repository at this point in the history
See #4
  • Loading branch information
nunofernandes committed Jun 15, 2020
1 parent fc1a59a commit 173064c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion local_cname/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import argparse
import socket
import time
import os
from pathlib import Path

from clickclick import Action, info
Expand Down Expand Up @@ -49,4 +50,9 @@ def main():
# ignore, do not print stacktrace
pass
finally:
backup_file.rename(hosts_file)
try:
backup_file.rename(hosts_file)
except OSError:
with hosts_file.open('w') as fd:
fd.write(old_contents)
os.remove(backup_file)

0 comments on commit 173064c

Please sign in to comment.