Skip to content

Commit d0e4945

Browse files
committed
Bug 1544727 - Moz-phab always fails with IOError when setting up logs. r=zalun
Differential Revision: https://phabricator.services.mozilla.com/D27698
1 parent e00be15 commit d0e4945

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

moz-phab

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ HOME_DIR = os.path.expanduser("~")
7777

7878
# Arcanist
7979
MOZBUILD_PATH = os.path.join(HOME_DIR, ".mozbuild", "moz-phab")
80+
LOG_FILE = os.path.join(MOZBUILD_PATH, "moz-phab.log")
8081
LIBPHUTIL_PATH = os.path.join(MOZBUILD_PATH, "libphutil")
8182
ARC_PATH = os.path.join(MOZBUILD_PATH, "arcanist")
8283
ARC_COMMAND = os.path.join(ARC_PATH, "bin", "arc.bat" if IS_WINDOWS else "arc")
@@ -2230,11 +2231,8 @@ def install_arc_if_required():
22302231
return
22312232

22322233
logger.warning("Installing arc")
2233-
logger.debug("arc command: ", ARC_COMMAND)
2234-
logger.debug("libphutil path: ", LIBPHUTIL_PATH)
2235-
2236-
if not os.path.exists(MOZBUILD_PATH):
2237-
os.makedirs(MOZBUILD_PATH)
2234+
logger.debug("arc command: %s", ARC_COMMAND)
2235+
logger.debug("libphutil path: %s", LIBPHUTIL_PATH)
22382236

22392237
check_call(["git", "clone", "--depth", "1", ARC_URL, ARC_PATH])
22402238
check_call(["git", "clone", "--depth", "1", LIBPHUTIL_URL, LIBPHUTIL_PATH])
@@ -3058,9 +3056,7 @@ def init_logging():
30583056
logger.addHandler(stdout_handler)
30593057

30603058
file_handler = logging.handlers.TimedRotatingFileHandler(
3061-
filename=os.path.join(HOME_DIR, ".mozbuild", "moz-phab", "moz-phab.log"),
3062-
when="midnight",
3063-
backupCount=7,
3059+
filename=LOG_FILE, when="midnight", backupCount=7
30643060
)
30653061
file_handler.setFormatter(
30663062
logging.Formatter("%(asctime)-13s %(levelname)-8s %(message)s")
@@ -3275,6 +3271,9 @@ def parse_args(argv):
32753271
def main(argv):
32763272
global config, HAS_ANSI, DEBUG
32773273
try:
3274+
if not os.path.exists(MOZBUILD_PATH):
3275+
os.makedirs(MOZBUILD_PATH)
3276+
32783277
init_logging()
32793278
config = Config()
32803279

0 commit comments

Comments
 (0)