Skip to content

Instantly share code, notes, and snippets.

@laixintao
Created Feb 14, 2020
Embed
What would you like to do?
# -*- coding: utf-8 -*-
import os
import sys
from prompt_toolkit import prompt
pid = os.getpid()
print("old: ", pid)
forked_pid = os.fork()
print("forked pid: ", forked_pid)
if forked_pid == pid:
print("Im exiting...")
sys.exit()
pid = os.getpid()
print("my pid: ", pid)
def run_console():
print("You said: %s" % prompt(">>>: "))
run_console()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment