Kattis / problemtools

Tools to manage problem packages using the Kattis problem package format.
MIT License
101 stars 70 forks source link

Replace os.system with subprocess.call; add code_size() to Problem class #127

Closed ghamerly closed 5 years ago

ghamerly commented 5 years ago

Two commits -- for two different issues

First commit fixes #126 Second commit fixes #125 in a generic way

simonlindholm commented 5 years ago

The return values of os.system and subprocess.call are different -- os.system returns a C exit code which should be checked by os.WIFEXITED etc., while subprocess.call returns either a non-negative number to indicate a normal exit with that return code, or a negative value to indicate a signal.

ghamerly commented 5 years ago

The return values of os.system and subprocess.call are different -- os.system returns a C exit code which should be checked by os.WIFEXITED etc., while subprocess.call returns either a non-negative number to indicate a normal exit with that return code, or a negative value to indicate a signal.

I was worried about that, but could not find good documentation on it quickly (e.g. this link seems not to point out the differences clearly, even though it should: https://docs.python.org/2/library/subprocess.html#replacing-os-system). I'll make some updates.

austrin commented 5 years ago

@ghamerly looks fine to me, can we merge?

ghamerly commented 5 years ago

@ghamerly looks fine to me, can we merge?

Yes, sorry for the slow response. Just rebased for the merge.