Skip to content
This repository was archived by the owner on Jul 22, 2022. It is now read-only.

Commit 029c866

Browse files
committed
Network
1 parent 734e47f commit 029c866

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

dockerjudge/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
def judge(processor, source, tests, config=None,
1717
client=docker.from_env()):
1818
'Main function'
19-
container = client.containers.run(processor.image, detach=True,
20-
network_disabled=True, tty=True)
19+
config = config or {}
20+
container = client.containers.run(
21+
processor.image, detach=True, tty=True,
22+
network_disabled=not config.get('network')
23+
)
2124
try:
2225
return run(container, processor, source, tests, config)
2326
finally:
@@ -67,7 +70,6 @@ def judge_test_cases(container, processor, tests, config):
6770

6871
def run(container, processor, source, tests, config=None):
6972
'Compile and judge'
70-
config = config or {}
7173
config.setdefault('callback', {})
7274
exec_result = compile_source_code(container, processor, source, config)
7375
if exec_result.exit_code:

0 commit comments

Comments
 (0)