kopia lustrzana https://github.com/jupyterhub/repo2docker
Fix Read-Only filesystem permission issue for log file
rodzic
61247bec16
commit
3ee04e34a3
|
@ -30,17 +30,21 @@ def main():
|
||||||
# 2. current working directory: "."
|
# 2. current working directory: "."
|
||||||
# 3. default temp directory for the OS (e.g. /tmp for linux)
|
# 3. default temp directory for the OS (e.g. /tmp for linux)
|
||||||
log_dirs = [".", tempfile.gettempdir()]
|
log_dirs = [".", tempfile.gettempdir()]
|
||||||
|
log_file = None
|
||||||
if "REPO_DIR" in os.environ:
|
if "REPO_DIR" in os.environ:
|
||||||
log_dirs.insert(0, os.environ["REPO_DIR"])
|
log_dirs.insert(0, os.environ["REPO_DIR"])
|
||||||
for d in log_dirs:
|
for d in log_dirs:
|
||||||
log_path = os.path.join(d, ".jupyter-server-log.txt")
|
log_path = os.path.join(d, ".jupyter-server-log.txt")
|
||||||
try:
|
try:
|
||||||
log_file = open(log_path, "ab")
|
log_file = open(log_path, "ab")
|
||||||
except PermissionError:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
# success
|
# success
|
||||||
break
|
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
|
# build the command
|
||||||
# like `exec "$@"`
|
# like `exec "$@"`
|
||||||
|
|
Ładowanie…
Reference in New Issue