Skip to content

Log output for subprocess calls if it is not being printed #1918

@rmartin16

Description

@rmartin16

Describe the bug

If you consider Subprocess.check_output(), it will log both stdout and stderr in the event of an error.

However, Subprocess.run() does not attempt to log either stdout or stderr in the event of an error. The most likely reason for this is because stdout and stderr are being written to the console as the subprocess command runs. In the event that stdout and stderr are being piped, though, the content may be lost altogether.

Steps to reproduce

One example is an error during macOS code signing since stderr is being piped for inspection is certain error cases but never written for fatal errors.

Expected behavior

In the event that subprocess.run() is piping an output, ensure that output is captured in the log for an error.

Screenshots

No response

Environment

  • Operating System: n/a
  • Python version: n/a
  • Software versions:
    • Briefcase: 0.3.20.dev47+g77cb18ec

Logs

In the log, you can see stderr has content, but it is not being fully captured in the log.

https://github.com/user-attachments/files/16044976/briefcase.2024_06_30-10_13_00.package.log

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA crash or error in behavior.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions