Skip to content

Conversation

@marcoesters
Copy link
Contributor

@marcoesters marcoesters commented Nov 11, 2025

Description

The logging experience for EXE installers has several problems that make debugging difficult to impossible:

  • Log files are written before the installation starts. This can cause install.log files to appear inside %USERPROFILE% or even cause the installation to fail because the check for empty directories fail due to the log file.
  • Output of conda invocations are only visible in the GUI. not in the CLI or in the log file.
  • No error messages are visible if calling binaries (like icacls.exe or python.exe) fails.

This PR addresses these issues by:

  • Only enabling logging after $INSTDIR has been created.
  • Outputting to file in silent mode and writing the content of that file both to log and to the console.
  • Executing commands in a cmd.exe subshell to output error messages coming from executing the binary (e.g., if it's not found or if there are permission issues). This makes pythonw.exe obsolete and outputs errors from the custom Python script.
  • Moving registry entry removal to the beginning of the installation. This doesn't just allow these commands to be logged, it also doesn't make users remove these registry entries manually should the installation fail for other reasons.
  • Stopping the logging right before the installation directory is removed so that a user doesn't have to reboot. This led me to making "abort" the default choice for AbortRetryNSExecWait so that logs are still available if the uninstallation fails (continuing even though steps fail shouldn't be happening in the first place to avoid undefined behavior, in my opinion).

I also decided to remove unused functions, which resulted in Utils.nsh only containing the IsWritable function. I could move that function into the main template, or I can move the functions inside the FunctionTemplates macro and the Print macro into Utils.nsh.

Caveats:

  • The conda commands cannot directly write into install.log even if they support --log-file because NSIS maintains the file handle on the log file and doesn't allow writing to it outside LogSet.
  • Since cmd.exe does not support the tee command, there is a trade-off between live printing for GUI installers and logging for system calls. I prioritized getting real time output into the GUI window over writing to the log file.

This also closes #998

Xref: conda/conda-standalone#218

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Nov 11, 2025
@github-project-automation github-project-automation bot moved this to 🆕 New in 🔎 Review Nov 11, 2025
@marcoesters
Copy link
Contributor Author

@jaimergp, this can get a preliminary review, but I will keep it in draft until conda/conda-standalone#218 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed [bot] added once the contributor has signed the CLA

Projects

Status: 🆕 New

Development

Successfully merging this pull request may close these issues.

EXE: Improve logging of python.exe commands

2 participants