Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
codejail
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
codejail
Commits
cbc533a0
Commit
cbc533a0
authored
Jul 17, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make a clearer distinction between argv and argv. :)
parent
7df8265c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
codejail/jail_code.py
+11
-2
No files found.
codejail/jail_code.py
View file @
cbc533a0
...
@@ -40,7 +40,12 @@ def configure(command, bin_path, user=None):
...
@@ -40,7 +40,12 @@ def configure(command, bin_path, user=None):
# -B means don't try to write .pyc files.
# -B means don't try to write .pyc files.
cmd_argv
.
extend
([
'-E'
,
'-B'
])
cmd_argv
.
extend
([
'-E'
,
'-B'
])
COMMANDS
[
command
]
=
{
'argv'
:
cmd_argv
,
'user'
:
user
}
COMMANDS
[
command
]
=
{
# The start of the command line for this program.
'cmdline_start'
:
cmd_argv
,
# The user to run this as, perhaps None.
'user'
:
user
,
}
def
is_configured
(
command
):
def
is_configured
(
command
):
...
@@ -186,13 +191,17 @@ def jail_code(command, code=None, files=None, argv=None, stdin=None,
...
@@ -186,13 +191,17 @@ def jail_code(command, code=None, files=None, argv=None, stdin=None,
cmd
=
[]
cmd
=
[]
# Build the command to run.
user
=
COMMANDS
[
command
][
'user'
]
user
=
COMMANDS
[
command
][
'user'
]
if
user
:
if
user
:
# Run as the specified user
# Run as the specified user
cmd
.
extend
([
'sudo'
,
'-u'
,
user
])
cmd
.
extend
([
'sudo'
,
'-u'
,
user
])
# Point TMPDIR at our temp directory.
cmd
.
extend
([
'TMPDIR=tmp'
])
cmd
.
extend
([
'TMPDIR=tmp'
])
cmd
.
extend
(
COMMANDS
[
command
][
'argv'
])
# Start with the command line dictated by "python" or whatever.
cmd
.
extend
(
COMMANDS
[
command
][
'cmdline_start'
])
# Add the code-specific command line pieces.
cmd
.
extend
(
argv
)
cmd
.
extend
(
argv
)
# Run the subprocess.
# Run the subprocess.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment