Skip to content

Commit f275413

Browse files
committed
Fixed runtime errors' dialog boxes.
1 parent f174207 commit f275413

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

pyjudge/compiler.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,9 @@ def __init__(self, source_path, source_type=None):
368368
r'.txt$': 'Text',
369369
r'.in$': 'Text', # De-facto standards by CCF
370370
r'.out$': 'Text', # De-facto standards by CCF
371-
r'.(in|out)\*$': 'Directory', # De-facto standards by CCF and pyJudge
371+
r'.ans$': 'Text', # De-facto standards by CCF
372+
r'.std$': 'Text', # Non-standard
373+
r'.(in|out|ans|std)\*$': 'Directory', # De-facto standards by CCF and pyJudge
372374
r'.cpp$': 'C++',
373375
r'.c\+\+$': 'C++',
374376
r'.c$': 'C',

pyjudge/judger.py

+1
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def __init__(self,
182182
raise AttributeError('Must provide output handle')
183183
if not stdout_handle:
184184
raise AttributeError('Must provide standard output handle')
185+
# Building compilers, in case they haven't been built
185186
if type(input_handle) == str:
186187
input_handle = compiler.AdaptiveCompiler(input_handle)
187188
self.input_handle_is_temp = True

pyjudge/process.py

+12
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11

22
import subprocess
3+
import sys
34
import threading
45
import time
56

67
from . import table
78

9+
# http://stackoverflow.com/questions/24130623/using-python-subprocess-popen-cant-prevent-exe-stopped-working-prompt
10+
if sys.platform.startswith('win'):
11+
import ctypes
12+
SEM_NOGPFAULTERRORBOX = 0x0002; # From MSDN
13+
ctypes.windll.kernel32.SetErrorMode(SEM_NOGPFAULTERRORBOX);
14+
CREATE_NO_WINDOW = 0x08000000; # From Windows API
15+
platform_subprocess_flags = CREATE_NO_WINDOW
16+
else:
17+
platform_subprocess_flags = 0
18+
819
class ProcessResult:
920
""" Result of process execution. """
1021
def __init__(self,
@@ -65,6 +76,7 @@ def __init__(self,
6576
def execute(self):
6677
# Starting process
6778
proc = subprocess.Popen(self.process_args,
79+
creationflags=platform_subprocess_flags,
6880
stdin=subprocess.PIPE,
6981
stdout=subprocess.PIPE,
7082
stderr=subprocess.PIPE)

setup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def readme():
77

88
setup(
99
name = 'pyjudge',
10-
version = '0.1.75',
10+
version = '0.1.78',
1111
description = 'OI programs Judger in Python',
1212
long_description = 'Judge OI programs easily with pyJudge.',
1313
classifiers = [
@@ -21,8 +21,8 @@ def readme():
2121
'Topic :: Education :: Testing',
2222
],
2323
keywords = 'judge judger oi',
24-
url = 'https://github.com/ht35268/pyjudge',
25-
author = 'ht35268',
24+
url = 'https://github.com/jeffswt/pyjudge',
25+
author = 'jeffswt',
2626
author_email = '',
2727
license = 'GPLv3',
2828
packages = [

0 commit comments

Comments
 (0)