Skip to content

Commit

Permalink
Pass in user id
Browse files Browse the repository at this point in the history
  • Loading branch information
remlapmot committed Sep 27, 2024
1 parent 98598be commit b812437
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions opensafely/rstudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import time
import webbrowser
from pathlib import Path
from sys import platform
from urllib import request

from opensafely import utils
Expand Down Expand Up @@ -112,6 +113,12 @@ def main(directory, name, port):
# Determine if on nt=windows or posix=Linux/Darwin/Unix
osname = os.name

# Determine if on Linux, if so obtain user id
if platform == "linux":
uid = os.getuid()
else:
uid = None

docker_args = [
"--platform=linux/amd64",
f"-p={port}:8787",
Expand All @@ -121,6 +128,8 @@ def main(directory, name, port):
+ os.path.join(os.path.expanduser("~"), ".gitconfig")
+ ":/home/rstudio/local-gitconfig",
f"--env=HOST={osname}",
f"--env=HOSTPLATFORM={platform}",
f"--env=HOSTUID={uid}",
]

debug("docker: " + " ".join(docker_args))
Expand Down

0 comments on commit b812437

Please sign in to comment.