Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output includes readline buffer? #27

Open
electricplant opened this issue Dec 30, 2024 · 4 comments
Open

output includes readline buffer? #27

electricplant opened this issue Dec 30, 2024 · 4 comments

Comments

@electricplant
Copy link

Hey,

This is probably a bit of a silly issue, but I'm really stumped on how to fix it. It seems like the output is being copied somehow? This is after I noticed the whole pwd was being copied over as well.

I removed all the prompts and anything that prints besides the necessary output, that didn't fix it unfortunately.

image

Any help would be appreciated. I am just trying to make sure my project is 100%

@MrSloth-dev
Copy link

Hello, this is related to the file descriptors that you are passing. I did a fork and some people got the same code and you in my tests but in another computer the tests were passing, I'm still learning to try to decipher why sends the prompt ( in my case I got a tests that send the hostname and pwd into the file descriptor) but I think it has to be related to the small delays in the builtin execution that aren't caught up in the redirections...

@LucasKuhn
Copy link
Owner

The way the tester works is by sending the test line to your minishell executable, eg:

line="echo hello world"
echo -e "$line" | ./minishell 2> /dev/null

+ some extra shenanigans where the tester tries to remove your prompt.

The whole idea is to pipe some commands to your executable and we expect that the result is the same as bash

echo -e 'echo 42' | ./minishell
echo -e 'echo 42' | bash
# both outputs should be the same

I would try something like echo -e 'echo 42' | ./minishell and see how it responds

Also, @MrSloth-dev , if you did a fork and fixed this with a better script please feel free to open a PR 🙏

@MrSloth-dev
Copy link

@LucasKuhn I already did a while ago when added valgrind to the tests, maybe next week I reformulate the PR and try again :)

@electricplant
Copy link
Author

Ah, thank you! I had completely forgotten about non-interactive mode... I will go implement it now and I'm sure it will work then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants