Skip to content

Instantly share code, notes, and snippets.

@mohsen0
Last active September 6, 2017 17:09
Show Gist options
  • Save mohsen0/4daa3c39eeb85cd66278c17593a5d29e to your computer and use it in GitHub Desktop.
Save mohsen0/4daa3c39eeb85cd66278c17593a5d29e to your computer and use it in GitHub Desktop.
running bash interactively inside a python script
import subprocess
import os
pid=subprocess.Popen("env -i DOCKER_MACHINE_NAME=default" +
                         " TERM=xterm-256color " +
                         " DOCKER_TLS_VERIFY=1 " +
                         " DOCKER_HOST="+DOCKER_HOST +
                         " DOCKER_CERT_PATH=" + cert_path +
                         r" PS1=" + DOCKER_HOST +
                         " bash -i", shell=True)
os.waitpid(pid.pid, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment