mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
judge: remove /nix path prefix
This commit is contained in:
1 parent
6bda0e58d3
commit
ad050ba1fb
3 files changed
+11
-3
No files matched your search
@@ -24,6 +24,10 @@ import {
|
||||
|
||||
const argv = cac().parse();
|
||||
|
||||
function removeNixPath(text: string) {
|
||||
return text.replace(/\/nix\/store\/[a-z0-9]{32}-/g, '/nix/');
|
||||
}
|
||||
|
||||
class JudgeTask {
|
||||
stat: Record<string, Date>;
|
||||
session: any;
|
||||
@@ -137,7 +141,9 @@ class JudgeTask {
|
||||
log.debug('Next: %d %o', data);
|
||||
data.key = 'next';
|
||||
data.rid = new ObjectID(this.rid);
|
||||
if (data.case) data.case.message ||= '';
|
||||
if (data.case) data.case.message = removeNixPath(data.case.message || '');
|
||||
if (typeof data.message === 'string') data.message = removeNixPath(data.message);
|
||||
if (typeof data.compilerText === 'string') data.compilerText = removeNixPath(data.compilerText);
|
||||
this.ws.send(JSON.stringify(data));
|
||||
}
|
||||
|
||||
@@ -145,6 +151,8 @@ class JudgeTask {
|
||||
log.info('End: %o', data);
|
||||
data.key = 'end';
|
||||
data.rid = this.request.rid;
|
||||
if (typeof data.message === 'string') data.message = removeNixPath(data.message);
|
||||
if (typeof data.compilerText === 'string') data.compilerText = removeNixPath(data.compilerText);
|
||||
this.ws.send(JSON.stringify(data));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user