-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executors/NODEJS: add Node.js executor
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from dmoj.cptbox.filesystem_policies import ExactFile | ||
from dmoj.executors.script_executor import ScriptExecutor | ||
|
||
|
||
class Executor(ScriptExecutor): | ||
ext = 'js' | ||
command = 'node' | ||
nproc = -1 | ||
command_paths = ['node', 'nodejs'] | ||
syscalls = ['capget', 'eventfd2', 'shutdown'] | ||
address_grace = 1048576 | ||
test_program = """ | ||
process.stdin.on('readable', () => { | ||
const chunk = process.stdin.read(); | ||
if (chunk != null) { | ||
process.stdout.write(chunk); | ||
} | ||
}); | ||
""" | ||
|
||
def get_env(self): | ||
env = super().get_env() | ||
# Disable io_uring due to potential security implications | ||
env['UV_USE_IO_URING'] = '0' | ||
return env | ||
|
||
def get_fs(self): | ||
return super().get_fs() + [ExactFile('/usr/lib/ssl/openssl.cnf')] | ||
|
||
@classmethod | ||
def get_version_flags(cls, command): | ||
return ['--version'] |