Created
October 3, 2019 10:15
-
-
Save OsandaMalith/5ab6f77b85d3db680a3c67d8a81348cb to your computer and use it in GitHub Desktop.
A simple python shell
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
import subprocess | |
import os | |
import sys | |
''' | |
A simple python shell | |
Author: @OsandaMalith | |
''' | |
while True: | |
try: | |
Input = raw_input("Osanda> ") | |
cmd = Input.split() | |
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
o, e = proc.communicate() | |
print (o.decode('ascii')) | |
print(e.decode('ascii')) | |
except Exception, e: | |
continue | |
except KeyboardInterrupt: | |
sys.exit("\nClosing shell...") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment