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

when testing the current philo_bonus, throws error #15

Open
ytkimirti opened this issue Sep 14, 2022 · 0 comments
Open

when testing the current philo_bonus, throws error #15

ytkimirti opened this issue Sep 14, 2022 · 0 comments

Comments

@ytkimirti
Copy link

It throws this exception because it can't get the output of the command.

Traceback (most recent call last):
  File "socrates/socrates.py", line 302, in <module>
    exit(socrates(args.path, args.philo))
  File "socrates/socrates.py", line 263, in socrates
    test_program(f"{bin_path}/philo_bonus/philo_bonus")
  File "socrates/socrates.py", line 177, in test_program
    if run_starvation_measures(binary) is False:
  File "socrates/socrates.py", line 151, in run_starvation_measures
    results.append(measure_starvation_timing(binary))
  File "socrates/socrates.py", line 114, in measure_starvation_timing
    if data[-1] == "\0":
IndexError: string index out of range

The reason is that the new bonus of the philosophers project says every philosopher has to be a process. So when it tries to get the output of ./philo_bonus, it doesn't capture the output from it's child processes.

So the string data becomes an empty string and throws an exception.

I couldn't really think of a way of capturing output from child processes but I will look into that.

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

1 participant