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

Commit 69190d9

Browse files
committed
options accepts str
1 parent 6bc5792 commit 69190d9

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

dockerjudge/processor.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from enum import Enum
55
from pathlib import PurePosixPath
6+
import shlex
67

78

89
class Processor():
@@ -72,8 +73,10 @@ def __init__(self, language=None, version=None,
7273
self.compile = ([{self.Language.c: 'clang',
7374
self.Language.cpp: 'clang++'}[lang] + f'-{version}',
7475
self.source]
75-
+ (['-o', fns['bin']]
76-
if fns.get('bin') else []) + args)
76+
+ (['-o', fns['bin']] if fns.get('bin')
77+
else [])
78+
+ (shlex.split(args) if isinstance(args, str)
79+
else args))
7780
self.after_compile = ['rm', self.source]
7881
self.judge = f"./{fns.get('bin', 'a.out')}"
7982

@@ -103,8 +106,10 @@ def __init__(self, language=None, version=None,
103106
self.Language.cpp: 'g++',
104107
self.Language.go: 'gccgo'}[lang],
105108
self.source]
106-
+ (['-o', fns['bin']]
107-
if fns.get('bin') else []) + args)
109+
+ (['-o', fns['bin']] if fns.get('bin')
110+
else [])
111+
+ (shlex.split(args) if isinstance(args, str)
112+
else args))
108113
self.after_compile = ['rm', self.source]
109114
self.judge = f"./{fns.get('bin', 'a.out')}"
110115

0 commit comments

Comments
 (0)