Skip to content

Commit 044df53

Browse files
committed
feat(judge): add bwrap existence check on linux, mitigate (#272)
1 parent 7545e02 commit 044df53

4 files changed

Lines changed: 29 additions & 4 deletions

File tree

src/core/judgingthread.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <QFile>
2121
#include <QFileInfo>
2222
#include <QRegularExpression>
23+
#include <QStandardPaths>
2324
#include <QTextStream>
2425
#include <QTime>
2526
#include <QUuid>
@@ -1086,9 +1087,17 @@ void JudgingThread::runProgram() {
10861087

10871088
qDebug() << argumentsList;
10881089

1090+
QString bwrapPath = QStandardPaths::findExecutable("bwrap");
1091+
if (bwrapPath.isEmpty()) {
1092+
score = 0;
1093+
result = CannotStartProgram;
1094+
message = tr("bwrap not found. Please install bubblewrap.");
1095+
return;
1096+
}
1097+
10891098
runner->setProcessEnvironment(environment);
10901099
runner->setWorkingDirectory(workingDirectory);
1091-
runner->start("/usr/bin/bwrap", argumentsList);
1100+
runner->start(bwrapPath, argumentsList);
10921101

10931102
#else
10941103

translations/en_US.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ Depends: </source>
12901290
</message>
12911291
<message>
12921292
<source>Contestant %3 Test case %1.%2: </source>
1293-
<translation type="unfinished"></translation>
1293+
<translation></translation>
12941294
</message>
12951295
</context>
12961296
<context>
@@ -1351,6 +1351,10 @@ Depends: </source>
13511351
<source>Cannot copy standard input file</source>
13521352
<translation></translation>
13531353
</message>
1354+
<message>
1355+
<source>bwrap not found. Please install bubblewrap.</source>
1356+
<translation></translation>
1357+
</message>
13541358
</context>
13551359
<context>
13561360
<name>LemonLime</name>

translations/zh_CN.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,10 @@ Depends: </source>
13761376
<source>Cannot copy standard input file</source>
13771377
<translation>无法复制标准输入文件</translation>
13781378
</message>
1379+
<message>
1380+
<source>bwrap not found. Please install bubblewrap.</source>
1381+
<translation>bwrap 未找到。请安装 Bubblewarp。</translation>
1382+
</message>
13791383
</context>
13801384
<context>
13811385
<name>LemonLime</name>

translations/zh_TW.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,10 @@
508508
<source>New configuration %1</source>
509509
<translation>新建配置 %1</translation>
510510
</message>
511+
<message>
512+
<source>Interpreter As Watcher</source>
513+
<translation type="unfinished"></translation>
514+
</message>
511515
</context>
512516
<context>
513517
<name>CompilerSettings</name>
@@ -1372,6 +1376,10 @@ Depends: </source>
13721376
<source>Cannot copy standard input file</source>
13731377
<translation>無法複製標準輸入檔案</translation>
13741378
</message>
1379+
<message>
1380+
<source>bwrap not found. Please install bubblewrap.</source>
1381+
<translation>bwrap 未找到。請安裝 Bubblewrap。</translation>
1382+
</message>
13751383
</context>
13761384
<context>
13771385
<name>LemonLime</name>
@@ -2513,11 +2521,11 @@ p, li { white-space: pre-wrap; }
25132521
<name>TaskJudger</name>
25142522
<message>
25152523
<source>Preparing...</source>
2516-
<translation type="unfinished">準備中…</translation>
2524+
<translation>準備中…</translation>
25172525
</message>
25182526
<message>
25192527
<source>Compiling...</source>
2520-
<translation type="unfinished">編譯中…</translation>
2528+
<translation>編譯中…</translation>
25212529
</message>
25222530
<message>
25232531
<source>Main grader (grader.*) cannot be found</source>

0 commit comments

Comments
 (0)