Skip to content

Commit

Permalink
some language tweaks and cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
bloodearnest committed Oct 17, 2024
1 parent 7e38922 commit b86bf7a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion opensafely/jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def add_arguments(parser):
"--port",
"-p",
default=None,
help="Port to run on",
help="Port to run on (random by default)",
)
parser.add_argument(
"jupyter_args",
Expand Down
16 changes: 9 additions & 7 deletions opensafely/rstudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ def add_arguments(parser):
parser.add_argument(
"--name", help="Name of docker image (defaults to use directory name)"
)

parser.add_argument(
"--port",
"-p",
default=None,
help="Port to run on",
help="Port to run on (random by default)",
)


Expand All @@ -37,8 +36,6 @@ def main(directory, name, port):

url = f"http://localhost:{port}"

# Determine if on Linux, if so obtain user id
# And need to know in Windows win32 for text file line endings setting
if platform == "linux":
uid = os.getuid()
else:
Expand All @@ -57,14 +54,19 @@ def main(directory, name, port):

utils.debug("docker: " + " ".join(docker_args))
print(
f"Opening an RStudio Server session at http://localhost:{port}/ when "
"you are finished working please press Ctrl+C here to end the session"
f"Opening an RStudio Server session at {url}. "
"When you are finished working please press Ctrl+C here to end the session"
)

utils.open_browser_in_thread(url)

ps = utils.run_docker(
docker_args, "rstudio", "", interactive=True, user="0:0", directory=directory
docker_args,
image="rstudio",
interactive=True,
# rstudio needs to start as root, but drops privileges to uid later
user="0:0",
directory=directory,
)

# we want to exit with the same code that rstudio-server did
Expand Down
2 changes: 1 addition & 1 deletion opensafely/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def git_bash_tty_wrapper():
def run_docker(
docker_args,
image,
cmd,
cmd=(),
directory=None,
interactive=False,
user=None,
Expand Down

0 comments on commit b86bf7a

Please sign in to comment.