Skip to content

Commit e733bba

Browse files
committed
derp
Signed-off-by: Tathagat Thapliyal <tathagat.thapliyal@gmail.com>
1 parent 640d501 commit e733bba

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/tasks/submission.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { cat, exec, mkdir, rm } from 'shelljs'
33
import { SubmissionJob, SubmissionResult } from '../types/job'
44
import * as path from 'path'
55
import * as fs from 'fs'
6+
import http = require('http')
67

78
rm('-rf', config.RUNBOX.DIR)
89
mkdir('-p', config.RUNBOX.DIR)
@@ -12,8 +13,26 @@ async function execSubmission(job: SubmissionJob): Promise<SubmissionResult> {
1213
mkdir('-p', currentJobDir)
1314
const LANG_CONFIG = config.LANGS[job.lang]
1415

16+
job.testcases.map(testcase => {
17+
mkdir('-p', `currentJobDir/${testcase.id}`)
18+
// const file = fs.createWriteStream();
19+
Promise.all([http.get(testcase.input), http.get(testcase.output)])
20+
.then(values => {
21+
values.map(value => {
22+
23+
})
24+
})
25+
})
26+
const request = http.get(job.testcases, function (response) {
27+
response.pipe(file);
28+
});
29+
30+
31+
1532
fs.writeFileSync(path.join(currentJobDir, LANG_CONFIG.SOURCE_FILE),
1633
(new Buffer(job.source, 'base64')).toString('ascii'))
34+
fs.writeFileSync(path.join(currentJobDir, ),
35+
(new Buffer(job.testcases)))
1736

1837
exec(`docker run \\
1938
--cpus="${LANG_CONFIG.CPU_SHARE}" \\
@@ -31,6 +50,8 @@ async function execSubmission(job: SubmissionJob): Promise<SubmissionResult> {
3150
head -c 65536 ${path.join(currentJobDir, 'run.stdout')}
3251
`)
3352

53+
54+
3455
// Check for compile_stderr if can't find a stdout file ; stdout can be ''
3556
const compile_stderr = cat(path.join(currentJobDir, 'compile.stderr')).toString()
3657
const runguard_stderr = cat(path.join(currentJobDir, 'runguard.stderr')).toString()

0 commit comments

Comments
 (0)