Skip to content

stderr log needs modernization #138

Closed
@mharbison72

Description

The log file to which stderr is redirected in boot_common.py has a couple of issues that appear to have been inherited by the original py2 code from ~15 years ago.

  1. Writing next to sys.executable will generally mean writing to %PROGRAMFILES%, which UAC blocks when it is turned on. That results in losing the stderr output (unless the app is launched with Admin rights), as program output should go to %PROGRAMDATA%.

  2. The write() method for the stream is supposed to return the number of characters written. Let patched sys.stderr.write() and sys.stdout.write() return number of written bytes #134 addresses this.

  3. It looks like the write() method on the redirected stream has a couple of default parameters that are non-standard, and not supplied anywhere in the codebase. I think they can be dropped.

I ended up implementing a workaround for this in TortoiseHg[1], but it would be better to have this upstream. Probably the trickiest part will be figuring out what subpath to write to under %PROGRAMDATA%.

[1] https://foss.heptapod.net/mercurial/tortoisehg/thg/-/commit/15c88bb932f18c14f5d1ff6a277ebde5d722786e

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions