1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-14 16:33:45 -05:00
denoland-deno/tools/is_tty_test.py

28 lines
638 B
Python
Raw Normal View History

2019-02-02 22:05:30 -05:00
#!/usr/bin/env python
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import os
import pty
import select
import subprocess
from util import build_path, executable_suffix
from sys import stdin
from permission_prompt_test import tty_capture
IS_TTY_TEST_TS = "tests/is_tty.ts"
2019-02-11 12:57:26 -05:00
2019-02-02 22:05:30 -05:00
def is_tty_test(deno_exe):
2019-05-03 17:15:16 -04:00
cmd = [deno_exe, "run", IS_TTY_TEST_TS]
2019-02-02 22:05:30 -05:00
code, stdout, _ = tty_capture(cmd, b'')
assert code == 0
assert str(stdin.isatty()).lower() in stdout
2019-02-11 12:57:26 -05:00
2019-02-02 22:05:30 -05:00
def main():
deno_exe = os.path.join(build_path(), "deno" + executable_suffix)
is_tty_test(deno_exe)
2019-02-11 12:57:26 -05:00
2019-02-02 22:05:30 -05:00
if __name__ == "__main__":
main()