Exemplo n.º 1
0
Arquivo: stdio.py Projeto: dckc/typhon
def makeStdIn():
    vat = currentVat.get()
    uv_loop = vat.uv_loop
    stdinKind = ruv.guess_handle(0)
    if stdinKind == ruv.HANDLE_TTY:
        stdin = ruv.alloc_tty(uv_loop, 0, True)
        return StreamFount(ruv.rffi.cast(ruv.stream_tp, stdin), vat)
    else:
        return FileFount(ruv.alloc_fs(), 0, vat)
Exemplo n.º 2
0
def makeStdIn():
    vat = currentVat.get()
    uv_loop = vat.uv_loop
    stdinKind = ruv.guess_handle(0)
    if stdinKind == ruv.HANDLE_TTY:
        stdin = ruv.alloc_tty(uv_loop, 0, True)
        return StreamFount(ruv.rffi.cast(ruv.stream_tp, stdin), vat)
    else:
        return FileFount(ruv.alloc_fs(), 0, vat)
Exemplo n.º 3
0
 def stderr(self):
     vat = currentVat.get()
     uv_loop = vat.uv_loop
     kind = ruv.guess_handle(2)
     if kind == ruv.HANDLE_TTY:
         stderr = ruv.alloc_tty(uv_loop, 2, False)
         stream = ruv.wrapStream(ruv.rffi.cast(ruv.stream_tp, stderr), 1)
         return TTYSink(stderr, stream, vat)
     else:
         return FileSink(2, vat)
Exemplo n.º 4
0
 def stdin(self):
     vat = currentVat.get()
     uv_loop = vat.uv_loop
     kind = ruv.guess_handle(0)
     if kind == ruv.HANDLE_TTY:
         stdin = ruv.alloc_tty(uv_loop, 0, True)
         stream = ruv.wrapStream(ruv.rffi.cast(ruv.stream_tp, stdin), 1)
         return TTYSource(stdin, stream, vat)
     else:
         return FileSource(0, vat)
Exemplo n.º 5
0
Arquivo: stdio.py Projeto: dckc/typhon
 def stderr(self):
     vat = currentVat.get()
     uv_loop = vat.uv_loop
     kind = ruv.guess_handle(2)
     if kind == ruv.HANDLE_TTY:
         stderr = ruv.alloc_tty(uv_loop, 2, False)
         stream = ruv.wrapStream(ruv.rffi.cast(ruv.stream_tp, stderr), 1)
         return StreamSink(stream, vat)
     else:
         return FileSink(ruv.alloc_fs(), 2, vat)
Exemplo n.º 6
0
Arquivo: stdio.py Projeto: dckc/typhon
 def stdin(self):
     vat = currentVat.get()
     uv_loop = vat.uv_loop
     kind = ruv.guess_handle(0)
     if kind == ruv.HANDLE_TTY:
         stdin = ruv.alloc_tty(uv_loop, 0, True)
         stream = ruv.wrapStream(ruv.rffi.cast(ruv.stream_tp, stdin), 1)
         return StreamSource(stream, vat)
     else:
         return FileSource(ruv.alloc_fs(), 0, vat)
Exemplo n.º 7
0
Arquivo: stdio.py Projeto: dckc/typhon
def makeStdErr():
    vat = currentVat.get()
    uv_loop = vat.uv_loop
    stderrKind = ruv.guess_handle(2)
    if stderrKind == ruv.HANDLE_TTY:
        tty = ruv.alloc_tty(uv_loop, 2, False)
        # ruv.TTYSetMode(tty, ruv.TTY_MODE_RAW)
        return StreamDrain(ruv.rffi.cast(ruv.stream_tp, tty), vat)
    else:
        return FileDrain(ruv.alloc_fs(), 2, vat)
Exemplo n.º 8
0
 def stdout(self):
     vat = currentVat.get()
     uv_loop = vat.uv_loop
     kind = ruv.guess_handle(1)
     if kind == ruv.HANDLE_TTY:
         stdout = ruv.alloc_tty(uv_loop, 1, False)
         stream = ruv.wrapStream(ruv.rffi.cast(ruv.stream_tp, stdout), 1)
         return TTYSink(stdout, stream, vat)
     else:
         return FileSink(1, vat)
Exemplo n.º 9
0
def makeStdErr():
    vat = currentVat.get()
    uv_loop = vat.uv_loop
    stderrKind = ruv.guess_handle(2)
    if stderrKind == ruv.HANDLE_TTY:
        tty = ruv.alloc_tty(uv_loop, 2, False)
        # ruv.TTYSetMode(tty, ruv.TTY_MODE_RAW)
        return StreamDrain(ruv.rffi.cast(ruv.stream_tp, tty), vat)
    else:
        return FileDrain(ruv.alloc_fs(), 2, vat)
Exemplo n.º 10
0
Arquivo: stdio.py Projeto: dckc/typhon
def makeStdOut():
    vat = currentVat.get()
    uv_loop = vat.uv_loop
    stdoutKind = ruv.guess_handle(1)
    if stdoutKind == ruv.HANDLE_TTY:
        tty = ruv.alloc_tty(uv_loop, 1, False)
        # XXX works exactly as expected, including disabling most TTY signal
        # generation
        # ruv.TTYSetMode(tty, ruv.TTY_MODE_RAW)
        return StreamDrain(ruv.rffi.cast(ruv.stream_tp, tty), vat)
    else:
        return FileDrain(ruv.alloc_fs(), 1, vat)
Exemplo n.º 11
0
def makeStdOut():
    vat = currentVat.get()
    uv_loop = vat.uv_loop
    stdoutKind = ruv.guess_handle(1)
    if stdoutKind == ruv.HANDLE_TTY:
        tty = ruv.alloc_tty(uv_loop, 1, False)
        # XXX works exactly as expected, including disabling most TTY signal
        # generation
        # ruv.TTYSetMode(tty, ruv.TTY_MODE_RAW)
        return StreamDrain(ruv.rffi.cast(ruv.stream_tp, tty), vat)
    else:
        return FileDrain(ruv.alloc_fs(), 1, vat)