Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paigeadelethompson/a6df7613c5e248fd5d67b3277eeef8fb to your computer and use it in GitHub Desktop.
Save paigeadelethompson/a6df7613c5e248fd5d67b3277eeef8fb to your computer and use it in GitHub Desktop.
r, w = os.pipe2(os.O_NONBLOCK)
with open(Path("/proc/{pid}/fd/{fd}".format(pid=os.getpid(), fd=w)), "wb") as script:
script.write("""#!/usr/bin/env bash
bash -c "/opt/netcrave/bin/dockerd \
--config-file /etc/netcrave/_netcrave.json \
" \
exit ; true
""".encode("utf-8", "strict"))
script.flush()
await cmd_async("/usr/bin/env",
"bash",
"/proc/{pid}/fd/{fd}".format(pid=os.getpid(), fd=r))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment