mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-15 02:18:41 +00:00
96d4a3ecf7
Due to historical reasons, the code is in subfolder "1". With SVN removal, we place the code back and remove the annoying "1" folder.
39 lines
1002 B
JavaScript
39 lines
1002 B
JavaScript
#!/usr/bin/env node
|
|
|
|
var lint = require("./lint/lint");
|
|
|
|
lint.checkDir("mode");
|
|
lint.checkDir("lib");
|
|
lint.checkDir("addon");
|
|
lint.checkDir("keymap");
|
|
|
|
var ok = lint.success();
|
|
|
|
var files = new (require('node-static').Server)();
|
|
|
|
var server = require('http').createServer(function (req, res) {
|
|
req.addListener('end', function () {
|
|
files.serve(req, res, function (err/*, result */) {
|
|
if (err) {
|
|
console.error(err);
|
|
process.exit(1);
|
|
}
|
|
});
|
|
}).resume();
|
|
}).addListener('error', function (err) {
|
|
throw err;
|
|
}).listen(3000, function () {
|
|
var childProcess = require('child_process');
|
|
var phantomjs = require("phantomjs");
|
|
var childArgs = [
|
|
require("path").join(__dirname, 'phantom_driver.js')
|
|
];
|
|
childProcess.execFile(phantomjs.path, childArgs, function (err, stdout, stderr) {
|
|
server.close();
|
|
console.log(stdout);
|
|
if (err) console.error(err);
|
|
if (stderr) console.error(stderr);
|
|
process.exit(err || stderr || !ok ? 1 : 0);
|
|
});
|
|
});
|