forked from wuub/SublimePTY
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsublimepty.py
More file actions
27 lines (22 loc) · 699 Bytes
/
sublimepty.py
File metadata and controls
27 lines (22 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sublime
import sublime_plugin
import os
from process import Supervisor, SublimeView, PtyProcess, Win32Process
SUPERVISOR = Supervisor()
ON_WINDOWS = os.name == "nt"
def read_all():
SUPERVISOR.read_all()
sublime.set_timeout(read_all, 200)
read_all()
def process(id):
return SUPERVISOR.process(id)
class OpenPty(sublime_plugin.WindowCommand):
def run(self, shell=None, encodings=None, title="TERMINAL"):
sv = SublimeView()
sv.view.set_name(title);
if ON_WINDOWS:
proc = Win32Process(SUPERVISOR)
else:
proc = PtyProcess(SUPERVISOR, cmd = shell, encodings = encodings)
proc.attach_view(sv)
proc.start()