Test Case failing for #IP1

I’m stuck on Stage #(IP1).

The test checks the output before my program has finished printing it all.

Here are my logs:
remote: [tester::#IP1] Running tests for Stage #IP1 (Run a program)
remote: [tester::#IP1] Running ./your_program.sh
remote: [your-program] $
remote: [tester::#IP1] > my_exe Emily
remote: [your-program] Hello Emily
remote: [tester::#IP1] Expected: “Hello Emily! The secret code is 7427569622.”
remote: [tester::#IP1] Received: “Hello Emily”
remote: [your-program] ! The secret code is 7427569622.
remote: [your-program] $
remote: [tester::#IP1] Received output does not match expectation.

And here’s a snippet of my code:

fn execute_external_command(command: &str, arguments: &str) {
    if let Some(path) = find_command(command) {
        Command::new(path)
            .arg(arguments)
            .status()
            .expect("Failed to execute command");
    } else {
        println!("{}: command not found", command);
    }
}

Hi @bijancfarahani, could you upload your code to GitHub and share the link? It will be much easier to debug if I can run it directly.

thanks for the help

Thanks for sharing the link! I’ll take a look and get back to you by the end of the week.

I tried running your code against the previous stages, but it’s actually no longer passing the stage #IZ3 (The echo builtin).

Suggestions:

  1. Use our CLI to test against previous stages by running:
codecrafters test --previous
  1. Focus on fixing the early stages first, as later stages depend on them.

Closing this thread due to inactivity. If you still need assistance, feel free to reopen or start a new discussion!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.