Skip to content

Commit

Permalink
Swap compilation1 with compilation2 when 1 is empty and 2 is not empty
Browse files Browse the repository at this point in the history
This closes jutge-org#3
  • Loading branch information
Witixin1512 committed Oct 9, 2024
1 parent 5499d98 commit e0177ea
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions std/compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ def compile_no_main(self):
if util.file_exists('program.exe'):
return True
else:
util.write_file('compilation1.txt', "Unreported error. ")
if util.file_size('compilation1.txt') == 0:
if util.file_size('compilation2.txt') == 0:
util.write_file('compilation1.txt', "Unreported error. ")
else:
util.move_file('compilation2.txt', 'compilation1.txt')
util.del_file('program.exe')
return False

Expand Down Expand Up @@ -382,7 +386,11 @@ def compile_normal(self):
if util.file_exists('program.exe'):
return True
else:
util.write_file('compilation1.txt', 'Unreported error. ')
if util.file_size('compilation1.txt') == 0:
if util.file_size('compilation2.txt') == 0:
util.write_file('compilation1.txt', "Unreported error. ")
else:
util.move_file('compilation2.txt', 'compilation1.txt')
util.del_file('program.exe')
return False

Expand Down Expand Up @@ -430,7 +438,11 @@ def compile_no_main(self):
if util.file_exists('program.exe'):
return True
else:
util.write_file('compilation1.txt', "Unreported error. ")
if util.file_size('compilation1.txt') == 0:
if util.file_size('compilation2.txt') == 0:
util.write_file('compilation1.txt', "Unreported error. ")
else:
util.move_file('compilation2.txt', 'compilation1.txt')
util.del_file('program.exe')
return False

Expand Down

0 comments on commit e0177ea

Please sign in to comment.