GithubHelp home page GithubHelp logo

Comments (25)

Prinzhorn avatar Prinzhorn commented on June 17, 2024

It's also interesting that the Python docs regarding PYTHONUNBUFFERED say

Changed in version 3.7: The text layer of the stdout and stderr streams now is unbuffered.

Aren't we using "the text layer"?

from mitmproxy.

Prinzhorn avatar Prinzhorn commented on June 17, 2024

It behaves the same with the this ChatGTP Python parent process (just to rule out funny Node.js things):

import subprocess


def run_command(command):
    try:
        process = subprocess.Popen(
            command,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            shell=True,
            env=dict(PYTHONUNBUFFERED="1"),
        )

        while True:
            stdout_line = process.stdout.readline().decode().strip()

            if stdout_line:
                print("stdout:", stdout_line)

            # Check if both pipes are closed and process has terminated
            if not stdout_line and process.poll() is not None:
                break

    except Exception as e:
        print("Error:", e)


command = "/home/alex/Downloads/mitmproxy-10.2.4-linux-x86_64/mitmdump"
# command = "/home/alex/Downloads/mitmproxy-9.0.1-linux/mitmdump"
# command = "/home/alex/Downloads/mitmproxy-8.1.1-linux/mitmdump"
# command = "/home/alex/Downloads/mitmproxy-7.0.4-linux/mitmdump"
# command = "/home/alex/Downloads/mitmproxy-6.0.2-linux/mitmdump"
# command = "/home/alex/forks/mitmproxy/venv/bin/mitmdump"

run_command(command)

from mitmproxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.