Skip to content

What is the purpose of MIRAI_FLAGS in cargo_mirai? #14

@yaokunzhang

Description

@yaokunzhang

Hello! I am trying to get some help.In cargo_mirai.rs, the MIRAI_FLAGS environment variable is used to pass parameters related to Mirai. However, if the MIRAI_FLAGS is modified in cargo_mirai.rs, the default values of MIRAI_FLAGS will be lost. As a result, the main function will not receive the expected parameters. Additionally, even if the modified MIRAI_FLAGS are passed into the main function, the Mirai-related arguments will not be parsed correctly.

```rust
// Add cargo args to cmd until first `--`.
    for arg in args.by_ref() {
        if arg == "--" {
            break;
        }
        if arg == "--lib" {
            continue;
        }
        cmd.arg(arg);
    }

    // Serialize the remaining args into an environment variable.
    let args_vec: Vec<String> = args.collect();
    if !args_vec.is_empty() {
        cmd.env(
            "MIRAI_FLAGS",
            serde_json::to_string(&args_vec).expect("failed to serialize args"),
        );
    }

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions