Skip to content

Commit 189b0fb

Browse files
committed
fix csharp and move to node js 10
1 parent f404015 commit 189b0fb

File tree

5 files changed

+19
-9
lines changed

5 files changed

+19
-9
lines changed

config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ exports = module.exports = {
3939
CPU_SHARE: "0.8",
4040
MEM_LIMIT: '200m'
4141
},
42-
'nodejs6': {
42+
'nodejs8': {
4343
SOURCE_FILE: 'script.js',
4444
CPU_SHARE: "0.8",
4545
MEM_LIMIT: '300m'
4646
},
47-
'nodejs8': {
47+
'nodejs10': {
4848
SOURCE_FILE: 'script.js',
4949
CPU_SHARE: "0.8",
5050
MEM_LIMIT: '300m'

src/taskmaster.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ amqp.connect(`amqp://${config.AMQP.USER}:${config.AMQP.PASS}@${config.AMQP.HOST}
2121
channel.sendToQueue(successQ, (new Buffer(JSON.stringify(<RunResult>{
2222
id: job.id,
2323
stderr: jobResult.stderr,
24-
stdout: jobResult.stdout
24+
stdout: jobResult.stdout,
25+
time: jobResult.time,
26+
code: jobResult.code
2527
}))))
2628
channel.ack(msg)
2729
});

src/tasks/run.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,22 @@ function execRun (job: RunJob, executed: (result: RunResult) => void) {
2929
/bin/judge.sh -t 5
3030
`)
3131

32-
let stdout = cat(path.join(currentJobDir, 'run.stdout'))
32+
const stdout = cat(path.join(currentJobDir, 'run.stdout'))
3333

3434
// Check for compile_stderr if can't find a stdout file ; stdout can be ''
35-
let compile_stderr = stdout.stderr ? cat(path.join(currentJobDir, 'compile.stderr')) : ''
36-
let stderr = compile_stderr || cat((path.join(currentJobDir, 'run.stderr')).toString())
35+
const compile_stderr = cat(path.join(currentJobDir, 'compile.stderr')).toString()
36+
const runguard_stderr = cat(path.join(currentJobDir, 'runguard.stderr')).toString()
37+
let stderr = runguard_stderr || compile_stderr || cat((path.join(currentJobDir, 'run.stderr')).toString())
38+
39+
const run_time = cat(path.join(currentJobDir, 'runguard.time')).toString()
40+
const code = cat(path.join(currentJobDir, 'runguard.code')).toString()
3741

3842
executed({
3943
id: job.id,
4044
stderr: (new Buffer(stderr)).toString('base64'),
41-
stdout: (new Buffer(stdout)).toString('base64')
45+
stdout: (new Buffer(stdout)).toString('base64'),
46+
time: +run_time,
47+
code: +code
4248
})
4349

4450
rm('-rf', currentJobDir)

src/types/job.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export interface RunJob {
88
export interface RunResult {
99
stdout: string,
1010
stderr: string,
11+
time: number,
12+
code: number
1113
id: number
1214
}
1315

test/run.nodejs6.spec.ts renamed to test/run.nodejs10.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import {execRun} from '../src/tasks/run'
22
import {expect} from 'chai'
33

44

5-
describe('run - nodejs6', () => {
5+
describe('run - nodejs10', () => {
66
it('.js file runs correctly (NodeJS 6)', () => {
77
execRun({
88
id: 24,
9-
lang: 'nodejs6',
9+
lang: 'nodejs10',
1010
source: (new Buffer(`
1111
var readline = require('readline');
1212

0 commit comments

Comments
 (0)