Skip to content

Windows: scripts and CI wait 1–3 s for each proofline command because of the background update check #78

Open

Description

@Ahmar004

What happens

On Windows, if something reads proofline's output (a PowerShell variable $o = proofline …,
a pipe proofline … | …, a CI step, or an editor talking to proofline mcp), the command takes
1–3 seconds longer than it should. It happens whenever the CLI hasn't checked for updates in the
last 24 hours. On CI runners that's every command, because each job starts with an empty cache.

How to reproduce (PowerShell, v0.5.0)

# An empty cache folder makes the CLI think it hasn't checked for updates today.
$env:LOCALAPPDATA = (New-Item -ItemType Directory (Join-Path $env:TEMP ([guid]::NewGuid()))).FullName
Measure-Command { $o = proofline --version }   # 1.1–2.6 s
$env:PROOFLINE_NO_UPDATE_CHECK = '1'
Measure-Command { $o = proofline --version }   # ~10 ms

The repo's own test shows it too: on Windows, cargo test --locked fails
update::tests::detached_discovery_is_serialized_and_notices_arrive_on_the_next_invocation (a
timeout at src/update/tests.rs:291). CI runs tests only on Ubuntu, so it doesn't show up there.

Why

Once a day the CLI starts a hidden helper, proofline __update-check, to ask whether a newer
release exists, and doesn't wait for it. On Windows, Rust starts new processes with
bInheritHandles = TRUE, so the helper also gets copies of the parent's inheritable handles,
including the pipe that the parent's output goes into (rust-lang/rust#54760). Stdio::null() only
redirects the helper's own output; it doesn't stop those copies. So after proofline exits, the
helper is still holding the pipe, and whoever reads the output keeps waiting until the helper's
network request finishes (up to its 3 s timeout). Linux and macOS aren't affected.

Proposed fix

The direct fix needs unsafe (to clear the inherit flag), which unsafe_code = "forbid" rules
out, and std's safe option (CommandExt::inherit_handles) is still unstable. My proposal: on
Windows, start the background check only when the output goes straight to a console (where nothing
waits for the pipe to close), and in that case don't record a check attempt. The update notice is
only ever shown in a console anyway, so users lose nothing. I have this ready with tests and will
open a PR.

Activity

  1. Ahmar004 commented on Nov 22, 2026

    @Ahmar004
    Author

    I have sent a PR to solve this at #79
    Kindly have a look at that PR.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions