Created
February 14, 2020 01:19
-
-
Save laixintao/dbb5a2c38d4aeb30e040ab918bc0b239 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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