Skip to content

Conversation

@jschwe
Copy link
Member

@jschwe jschwe commented Nov 30, 2025

When servo is started from the command line, we still want output to be printed. On windows, due to us using the windows subsystem (as opposed to the default console subsystem), this doesn't work out-of-the-box, and we need to manually attempt to attach to the console of the parent process. If servo was not started from the command line, then the call will fail, which we can ignore.
Since we can now have the best of both worlds (i.e no popping up console window, and preserve stdout / stderr when started from a console), we can now unconditionally use the windows subsystem. (On non-windows platforms, windows-subsystem does nothing)

Testing: Manually tested. The original issue does not reproduce when redirecting stdout / stderr, so I don't see a way to write an automated test.
Fixes: #40211

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 30, 2025
Copy link
Member

@yezhizhen yezhizhen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Dec 1, 2025
@jschwe jschwe added this pull request to the merge queue Dec 1, 2025
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Dec 1, 2025
Merged via the queue into servo:main with commit f60274a Dec 1, 2025
35 checks passed
@jschwe jschwe deleted the jschwender/fix-windows-help branch December 1, 2025 04:21
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Dec 1, 2025
github-merge-queue bot pushed a commit that referenced this pull request Dec 1, 2025
…dows-sys` (#40980)

In #40961, we start to use `windows_sys::Win32::System::Console;`. This
is gated behind `Win32_System_Console` feature. We didn't have the
problem merging that one, because it was luckily enabled by some other
dependencies. But @dependabot can act weird: #40979, which would break
the build from time to time.

See
https://github.com/servo/servo/actions/runs/19816434323/job/56768628158.

Fixes: Treacherous bug that is only revealed when other crates's
`windows-sys` is downgraded.

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no --help on windows

3 participants