[C] Build your own shell - Stuck on #IP1 - Duplicate printing

Link to my GitHub repo here

I worked on this challenge a while ago, and decided to get back into it since it’s free this month. I guess some of the stages changed because stages I already passed started failing. I’ve been stuck on trying to fix this particular stage #IP1. The output I’m getting from this stage is printing twice and it’s really annoying. I’ve tried flushing stdout using fflush(stdout) and the output is still printing twice. I’m not sure what I’m doing wrong.

[tester::#IP1] Running tests for Stage #IP1 (Run a program)
[tester::#IP1] [setup] export PATH=/tmp/owl:$PATH
[tester::#IP1] [setup] Available executables:
[tester::#IP1] [setup] - custom_exe_7864
[tester::#IP1] [setup] - custom_exe_9710
[tester::#IP1] Running ./your_program.sh
[your-program] $ custom_exe_7864 David Maria
[your-program] Program was passed 3 args (including program name).
[your-program] Arg #0 (program name): custom_exe_7864
[your-program] Arg #1: David
[your-program] Arg #2: Maria
[your-program] Program was passed 3 args (including program name).
[tester::#IP1] ^ Line does not match expected value.
[tester::#IP1] Expected: "Program Signature: 6954224015"
[tester::#IP1] Received: "Program was passed 3 args (including program name)."
[your-program] Arg #0 (program name): /tmp/owl/custom_exe_7864
[your-program] Arg #1: David
[your-program] Arg #2: Maria
[your-program] Program Signature: 6954224015
[your-program] $ 
[tester::#IP1] Assertion failed.
[tester::#IP1] Test failed

Your repo link is inaccessible.

It looks like your program is literally writing “Program was passed X args (including program name)” as output which the tester is not expecting.

I accidentally had the repo set to private visibilty, but I just made it public. I’m calculating the number of arguments and printing that number to stdout with printf, as per the stage instructions.

It will then send a command that you need to execute:

$ custom_exe_1234 alice
Program was passed 2 args (including program name).
Arg #0 (program name): custom_exe_1234
Arg #1: alice
Program Signature: 5998595441

The output shown above comes from the executable itself. Your shell just needs to run it and let its output display.

But on line 167 you explicitly write “Program was passed ….”

But I admit, it has been a while, so I might be remembering and reading it wrong.

1 Like

Oh my gosh thank you! I just wasn’t reading the instructions properly!! I just removed the manual printing I was doing and it worked.

2 Likes

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