diff --git a/repo2docker/buildpacks/repo2docker-entrypoint b/repo2docker/buildpacks/repo2docker-entrypoint index 5d6dd50d..0ac72778 100755 --- a/repo2docker/buildpacks/repo2docker-entrypoint +++ b/repo2docker/buildpacks/repo2docker-entrypoint @@ -30,17 +30,21 @@ def main(): # 2. current working directory: "." # 3. default temp directory for the OS (e.g. /tmp for linux) log_dirs = [".", tempfile.gettempdir()] + log_file = None if "REPO_DIR" in os.environ: log_dirs.insert(0, os.environ["REPO_DIR"]) for d in log_dirs: log_path = os.path.join(d, ".jupyter-server-log.txt") try: log_file = open(log_path, "ab") - except PermissionError: + except Exception: continue else: # success break + # raise Exception if log_file could not be set + if log_file is None: + raise Exception("Could not open '.jupyter-server-log.txt' log file " ) # build the command # like `exec "$@"`