Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic (?) with #[windows_subsystem = "windows"] on Rust nightly #214

Closed
parasyte opened this issue Sep 1, 2021 · 2 comments
Closed

panic (?) with #[windows_subsystem = "windows"] on Rust nightly #214

parasyte opened this issue Sep 1, 2021 · 2 comments

Comments

@parasyte
Copy link

parasyte commented Sep 1, 2021

I spent an hour trying to reduce a minimal test case for this error I started experiencing with my app. I don't know if this is the right repo to track this, but so far I have produced the following:

[package]
name = "windows_explodey"
version = "0.1.0"
edition = "2018"
resolver = "2"

[dependencies]
env_logger = "0.9"

[profile.release]
panic = "abort"
#![windows_subsystem = "windows"]

fn main() {
    env_logger::init();

    println!("Hello, world!");
}

When running this on any nightly compiler since nightly-2021-08-21, I get an error like this:

$ cargo +nightly-2021-08-21 run
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `target\debug\windows_explodey.exe`
error: process didn't exit successfully: `target\debug\windows_explodey.exe` (exit code: 101)

Adjusting the profile to panic = "abort" causes an even more ominous error:

$ cargo +nightly-2021-08-21 run --release
    Finished release [optimized] target(s) in 0.03s
     Running `target\release\windows_explodey.exe`
error: process didn't exit successfully: `target\release\windows_explodey.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

I recognize it's probably silly to use #[windows_subsystem = "windows"] with env_logger. My workaround for now is conditionally calling env_logger::init() only on macOS and Linux.

@parasyte
Copy link
Author

parasyte commented Sep 1, 2021

I did some more digging and decided to report this upstream. Apologies for the noise!

@parasyte parasyte closed this as completed Sep 1, 2021
ede1998 added a commit to ede1998/traduora-update that referenced this issue Nov 22, 2021
env_logger init leads to abort if combined with #![windows_subsystem = "windows"]
See rust-cli/env_logger#214 for details.
@categulario
Copy link

I just experienced this issue. I think it would be helpful to have a heads-up message in the docs about it

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

No branches or pull requests

2 participants