Test #QJ0 fails all the time

The test on Stage #QJ0 always prints the same error, saying that the expected output is not the shell prompt ($ ). The same error occurred spontaneously in the previous stages as well, but now it is constant.

Here are the logs :

remote: [tester::#QJ0] Running tests for Stage #QJ0 (Quoting - Executing a quoted executable)
remote: [tester::#QJ0] Running ./your_program.sh
remote: [tester::#QJ0] Copying /tmp/custom_cat_executable to /tmp/quz/‘exe with space’
remote: [tester::#QJ0] Copying /tmp/custom_cat_executable to /tmp/quz/‘exe with “quotes”’
remote: [tester::#QJ0] Copying /tmp/custom_cat_executable to /tmp/quz/“exe with 'single quotes'”
remote: [tester::#QJ0] Copying /tmp/custom_cat_executable to /tmp/quz/‘exe with \n newline’
remote: [tester::#QJ0] Writing file “/tmp/quz/f1” with content “grape raspberry.”
remote: [tester::#QJ0] Writing file “/tmp/quz/f2” with content “pineapple strawberry.”
remote: [tester::#QJ0] Writing file “/tmp/quz/f3” with content “pear mango.”
remote: [tester::#QJ0] Writing file “/tmp/quz/f4” with content “strawberry raspberry.”
remote: [your-program] $
remote: [tester::#QJ0] > ‘exe with space’ /tmp/quz/f1
remote: [your-program] grape raspberry.
remote: [tester::#QJ0] ✓ Received expected response
remote: [tester::#QJ0] Expected prompt ("$ ") to be printed, got “”
remote: [tester::#QJ0] Test failed

my code is here:

Edit: I tried my code with multiple different quoted executable examples on my local machine (Linux). The program seems to work all right and print the shell prompt just fine.

Hi @i-JRay-i, I’ll take a look and get back to you before the end of the week.

Hello! Thank you for your consideration. I just wanted to inform that I tried several different solutions (also added some extra utilities) to my code. The error still persists as of now.

@i-JRay-i I experimented a bit and can confirm that the issue lies with the free calls. When I commented them out, everything worked as expected:

    // Freeing the memory of previous tokens after the command is analyzed
    // for (int arg_idx = 0; arg_idx < num_args; arg_idx++) {
    //   free(args[arg_idx]);
    //   args[arg_idx] = NULL;
    // }
  }

Interesting, thank you so much for your help! I did not attempt to touch the free calls for the args (since I tried to keep the command arguments dynamically allocated for this example), but when I commented them on the code everything worked fine.

I could only identify the issue, but properly fixing it will likely require more than just commenting out the free calls, as that could lead to potential memory leaks.