I’m stuck on Stage #GY5
My program passes all the completion tests, but fails at the append std out/err test by echoing the command, the behaviour is not consistent:
Passed test:
remote: [tester::#UN3] Running tests for Stage #UN3 (Redirection - Append stderr)
remote: [tester::#UN3] [setup] export PATH=/tmp/strawberry/mango/strawberry:$PATH
remote: [tester::#UN3] Running ./your_program.sh
remote: [your-program] $ ls -1 nonexistent >> /tmp/bar/bar.md
remote: [your-program] ls: nonexistent: No such file or directory
remote: [tester::#UN3] ✓ Received error message
remote: [tester::#UN3] ✓ File: /tmp/bar/bar.md is empty
remote: [your-program] $ ls -1 nonexistent 2>> /tmp/bar/foo.md
remote: [your-program] $ cat /tmp/bar/foo.md
remote: [your-program] ls: nonexistent: No such file or directory
remote: [tester::#UN3] ✓ Received redirected file content
remote: [your-program] $ echo "Emily says Error" 2>> /tmp/bar/quz.md
remote: [your-program] Emily says Error
remote: [tester::#UN3] ✓ Received redirected file content
remote: [your-program] $ cat nonexistent 2>> /tmp/bar/quz.md
remote: [your-program] $ ls -1 nonexistent 2>> /tmp/bar/quz.md
remote: [your-program] $ cat /tmp/bar/quz.md
remote: [your-program] cat: nonexistent: No such file or directory
remote: [your-program] ls: nonexistent: No such file or directory
remote: [tester::#UN3] ✓ Received redirected file content
remote: [your-program] $
remote: [tester::#UN3] Test passed.
Failed test:
remote: [your-program] $ ls -1 nonexistent >> /tmp/baz/bar.md
remote: [your-program] ls: nonexistent: No such file or directory
remote: [tester::#UN3] ✓ Received error message
remote: [tester::#UN3] ✓ File: /tmp/baz/bar.md is empty
remote: [your-program] $ ls -1 nonexistent 2>> /tmp/baz/foo.md
remote: [your-program] $ cat /tmp/baz/foo.md
remote: [your-program] ls: nonexistent: No such file or directory
remote: [tester::#UN3] ✓ Received redirected file content
remote: [your-program] $ echo "Emily says Error" 2>> /tmp/baz/qux.md
remote: [your-program] Emily says Error
remote: [tester::#UN3] ✓ Received redirected file content
remote: [your-program] $ cat nonexistent 2>> /tmp/baz/qux.md
remote: [your-program] cat nonexistent 2>> /tmp/baz/qux.md
remote: [tester::#UN3] Expected prompt ("$ ") but received "cat nonexistent 2>> /tmp/baz/qux.md"
remote: [your-program] $
remote: [tester::#UN3] Assertion failed.
cat and ls are executed by subprocess.run() function:
case default:
if identifier := shutil.which(identifier if identifier else ''):
subprocess.run(command_foo, shell = True)
else:
print(f'{command}: command not found')
where command_foo variable is a string copy of inputted command