kopia lustrzana https://github.com/jupyterhub/repo2docker
entrypoint needs to run on py35
rodzic
ebf640cb84
commit
a06991de50
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
# note: must run on Python >= 3.5
|
||||||
|
|
||||||
# goals:
|
# goals:
|
||||||
# - load environment variables from a login shell (bash -l)
|
# - load environment variables from a login shell (bash -l)
|
||||||
|
@ -35,7 +36,7 @@ def get_login_env():
|
||||||
try:
|
try:
|
||||||
return json.loads(last_line)
|
return json.loads(last_line)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error getting login env: {e}", file=sys.stderr)
|
print("Error getting login env: {e}".format(e=e), file=sys.stderr)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,7 +114,11 @@ def main():
|
||||||
|
|
||||||
def relay_signal(sig, frame):
|
def relay_signal(sig, frame):
|
||||||
"""Relay a signal to children"""
|
"""Relay a signal to children"""
|
||||||
print(f"Forwarding signal {sig} to {child_pgid}")
|
print(
|
||||||
|
"Forwarding signal {sig} to {child_pgid}".format(
|
||||||
|
sig=sig, child_pgid=child_pgid
|
||||||
|
)
|
||||||
|
)
|
||||||
os.killpg(child_pgid, sig)
|
os.killpg(child_pgid, sig)
|
||||||
|
|
||||||
# question: maybe use all valid_signals() except a few, e.g. SIGCHLD?
|
# question: maybe use all valid_signals() except a few, e.g. SIGCHLD?
|
||||||
|
|
Ładowanie…
Reference in New Issue