Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Seminar-HFO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
Seminar-HFO
Commits
ab30623f
Commit
ab30623f
authored
Jul 16, 2017
by
drallensmith
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into action_chart - update w/fixes
parents
0d6671ea
be18fc75
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
bin/HFO
bin/HFO
+26
-3
No files found.
bin/HFO
View file @
ab30623f
...
@@ -2,7 +2,13 @@
...
@@ -2,7 +2,13 @@
# encoding: utf-8
# encoding: utf-8
from
__future__
import
print_function
from
__future__
import
print_function
import
subprocess
,
os
,
time
,
numpy
,
sys
import
atexit
import
numpy
import
os
import
time
import
signal
import
subprocess
import
sys
# Global list of all/essential running processes
# Global list of all/essential running processes
processes
,
necProcesses
=
[],
[]
processes
,
necProcesses
=
[],
[]
...
@@ -12,6 +18,16 @@ SERVER_BIN = 'rcssserver'
...
@@ -12,6 +18,16 @@ SERVER_BIN = 'rcssserver'
# Command to run the monitor. Edit as needed; ditto to the above re directories.
# Command to run the monitor. Edit as needed; ditto to the above re directories.
MONITOR_BIN
=
'soccerwindow2'
MONITOR_BIN
=
'soccerwindow2'
def
cleanup
():
"""Cleanup even if doing SystemExit, as with term."""
for
p
in
reversed
(
processes
):
p
.
terminate
()
time
.
sleep
(
0.1
)
p
.
kill
()
def
term
(
received_signal
,
ignored_stack
):
sys
.
exit
(
"Signal {0!r} received; exiting"
.
format
(
received_signal
))
def
launch
(
cmd
,
name
=
'Unknown'
,
necessary
=
True
,
suppressOutput
=
True
):
def
launch
(
cmd
,
name
=
'Unknown'
,
necessary
=
True
,
suppressOutput
=
True
):
"""Launch a process.
"""Launch a process.
...
@@ -22,8 +38,8 @@ def launch(cmd, name = 'Unknown', necessary = True, suppressOutput = True):
...
@@ -22,8 +38,8 @@ def launch(cmd, name = 'Unknown', necessary = True, suppressOutput = True):
"""
"""
kwargs
=
{}
kwargs
=
{}
if
suppressOutput
:
if
suppressOutput
:
kwargs
=
{
'stdout'
:
open
(
'/dev/null'
,
'w'
),
kwargs
=
{
'stdout'
:
open
(
os
.
devnull
,
'w'
),
'stderr'
:
open
(
'/dev/null'
,
'w'
)}
'stderr'
:
open
(
os
.
devnull
,
'w'
)}
try
:
try
:
p
=
subprocess
.
Popen
(
cmd
.
split
(
' '
),
shell
=
False
,
**
kwargs
)
p
=
subprocess
.
Popen
(
cmd
.
split
(
' '
),
shell
=
False
,
**
kwargs
)
except
(
IOError
,
OSError
):
except
(
IOError
,
OSError
):
...
@@ -69,6 +85,13 @@ def main(args):
...
@@ -69,6 +85,13 @@ def main(args):
args
.
min_ball_x
,
args
.
max_ball_x
,
args
.
messageSize
,
args
.
min_ball_x
,
args
.
max_ball_x
,
args
.
messageSize
,
args
.
verbose
)
args
.
verbose
)
try
:
signal
.
signal
(
signal
.
SIGTERM
,
term
)
except
(
ValueError
,
AttributeError
):
print
(
"Not able to catch sigterm"
)
atexit
.
register
(
cleanup
)
try
:
try
:
# Launch the Server
# Launch the Server
server
=
launch
(
serverCommand
+
serverOptions
,
name
=
'server'
,
server
=
launch
(
serverCommand
+
serverOptions
,
name
=
'server'
,
...
...
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