socrates icon indicating copy to clipboard operation
socrates copied to clipboard

when testing the current philo_bonus, throws error

Open ytkimirti opened this issue 2 years ago • 0 comments

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.

ytkimirti avatar Sep 14 '22 15:09 ytkimirti