Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wims-info
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexandros Bokaris
wims-info
Commits
4b6689de
Commit
4b6689de
authored
10 years ago
by
Nicolas M. Thiéry
Browse files
Options
Downloads
Patches
Plain Diff
Added experimental script to compile and run programs in a docker sandbox
parent
54272f1f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test~coding~readingCppPrograms.fr/docker-compile-and-run
+25
-0
25 additions, 0 deletions
test~coding~readingCppPrograms.fr/docker-compile-and-run
with
25 additions
and
0 deletions
test~coding~readingCppPrograms.fr/docker-compile-and-run
0 → 100755
+
25
−
0
View file @
4b6689de
#!/bin/sh
usage
()
{
echo
docker-compile-and-run
[
program.cpp]
echo
echo
Compiles and executes a c++ program within a sandbox.
echo
The standard input and output is passed down to the program.
echo
The
exit
status is that of the compiler.
}
if
[
-n
$1
]
;
then
usage
exit
0
fi
ID
=
`
sudo
docker run
-d
crosbymichael/build-essential
sleep
1000
`
sudo
docker
exec
-i
$ID
sh
-c
"cat > prog.cpp"
<
$1
if
sudo
docker
exec
$ID
g++ prog.cpp
;
then
sudo
docker
exec
-i
$ID
./a.out
else
exit
$?
fi
sudo
docker
rm
-f
$ID
>
/dev/null 2>&1
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment