Skip to content

Commit 361468c

Browse files
committed
Scripts: Change wording for pseudoterminals
1 parent ba5a61f commit 361468c

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

tests/run-tests

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,28 +87,32 @@ def run_micropython(pyb, args, test_file, is_special=False):
8787
def get(required=False):
8888
rv = b''
8989
while True:
90-
ready = select.select([master], [], [], 0.02)
91-
if ready[0] == [master]:
92-
rv += os.read(master, 1024)
90+
ready = select.select([emulator], [], [], 0.02)
91+
if ready[0] == [emulator]:
92+
rv += os.read(emulator, 1024)
9393
else:
9494
if not required or rv:
9595
return rv
9696

9797
def send_get(what):
98-
os.write(master, what)
98+
os.write(emulator, what)
9999
return get()
100100

101101
with open(test_file, 'rb') as f:
102102
# instead of: output_mupy = subprocess.check_output(args, stdin=f)
103-
master, slave = pty.openpty()
104-
p = subprocess.Popen(args, stdin=slave, stdout=slave,
103+
# openpty returns two read/write file descriptors. The first one is
104+
# used by the program which provides the virtual
105+
# terminal service, and the second one is used by the
106+
# subprogram which requires a tty to work.
107+
emulator, subterminal = pty.openpty()
108+
p = subprocess.Popen(args, stdin=subterminal, stdout=subterminal,
105109
stderr=subprocess.STDOUT, bufsize=0)
106110
banner = get(True)
107111
output_mupy = banner + b''.join(send_get(line) for line in f)
108112
send_get(b'\x04') # exit the REPL, so coverage info is saved
109113
p.kill()
110-
os.close(master)
111-
os.close(slave)
114+
os.close(emulator)
115+
os.close(subterminal)
112116
else:
113117
output_mupy = subprocess.check_output(args + [test_file], stderr=subprocess.STDOUT)
114118
except subprocess.CalledProcessError:

tools/pyboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def inWaiting(self):
191191

192192

193193
class ProcessPtyToTerminal:
194-
"""Execute a process which creates a PTY and prints slave PTY as
194+
"""Execute a process which creates a PTY and prints secondary PTY as
195195
first line of its output, and emulate serial connection using
196196
this PTY."""
197197

0 commit comments

Comments
 (0)