Skip to content

Prompt issue #208

@Minecraft-vIIr

Description

@Minecraft-vIIr

Sometimes the prompt (PS C:\Users\foo>) does not appear, but after I press enter, there will be 2 prompts.

import threading
from winpty import PtyProcess, PTY

def read_output(proc):
    while proc.isalive():
        output = proc.read()
        print(output, end="")

proc = PtyProcess.spawn("powershell.exe")
# proc = PTY(80, 25)
# proc.spawn("cmd.exe")

thread = threading.Thread(target=read_output, args=(proc,))
thread.start()

while True:
    command = input()

    proc.write(command + "\r")

    # proc.terminate()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions