skywind3000 / skywind3000/PyStand

请教:将python的stdout重定向到文件

Open
#65 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.2k
Forks
146
PR merge metrics
No merged PRs in 30d

Description

当前,python的stdout、stderr会被重定向到pystand进程的控制台(如果存在)。

假如希望将pystand的输出重定向到文件,如:

pystand.exe > test.txt

是无法实现的, test.txt 依然为空。

或者用另一个程序调用 pystand.exe ,也无法在管道获取输出内容。

请问,如何实现让pystand输出到正确的地方?

即:如果pystand进程的stdout存在,那么将python的stdout也重定向到相同的地方。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the pystand.exe process entry point and trace how Python stdout and stderr are connected to the host console. Reproduce the shell redirection and pipe cases described in the issue. Done means output reaches the same destination as pystand's stdout when it exists, while preserving console output otherwise.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.