Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Further Upcoming Gitlab Maintenance - May 26 - 03:30 UTC (2 hours) - Final Upgrade to 15.0.0
Open sidebar
thorsummoner
ttt_terrorcon
Commits
73e97969
Commit
73e97969
authored
Sep 19, 2021
by
dylan grafmyre
Browse files
epoll-then
parent
04418fc7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
73e97969
...
...
@@ -178,10 +178,12 @@ maps/%.bsp: %.bsp
ln
-f
lua/nav_generate.lua
"
$(MOD_DIR)
/lua/autorun/runme.lua"
$(SHLEX_BIN)
$(SHLEX_FLAGS)
$(SHLEX_HL2LOG_FLAGS)
\
"'
$(GAME_DIR)$(GAME)
'"
-allowdebug
$(VBIN_FLAGS)
$(GAME_FLAGS)
$(GAME_TTT_FLAGS)
\
+sv_cheats 1 +nav_edit 1 +map navgen
||
true
$(SHLEX_BIN)
$(SHLEX_FLAGS)
$(EPOLL_THEN_BIN)
$(EPOLL_THEN_FLAGS)
--literal
ng_2
--file
"'
$(MOD_DIR)
/data/runme.txt'"
--
\
echo
TIME TO DO THINGS &
# todo: check "
$(MOD_DIR)
/data/runme.txt
" for content "
ng_f
", to trigger kill hl2.exe
+sv_cheats 1 +nav_edit 1 +map navgen &
$(SHLEX_BIN)
$(SHLEX_FLAGS)
$(EPOLL_THEN_BIN)
$(EPOLL_THEN_FLAGS)
\
--literal
ng_f
--file
"'
$(MOD_DIR)
/data/runme.txt'"
--timeout-sec
1800
--
\
kill
$$
!
# ^ watch "
$(MOD_DIR)
/data/runme.txt
" for content "
ng_f
", when match: kill hl2.exe
# timeout: 30min
cp -v "
$(MOD_DIR)
/maps/navgen.nav
"
$@
rm -v
\
"
$(MOD_DIR)
/lua/autorun/runme.lua
"
\
...
...
contrib/epoll-then
View file @
73e97969
...
...
@@ -16,6 +16,7 @@ ARGP.add_argument('remainder', nargs=argparse.REMAINDER)
ARGP
.
add_argument
(
'--file'
,
required
=
True
)
ARGP
.
add_argument
(
'--literal'
,
required
=
True
)
ARGP
.
add_argument
(
'--poll-sec'
,
type
=
float
,
default
=
2
)
ARGP
.
add_argument
(
'--timeout-sec'
,
type
=
float
)
def
main
(
argp
=
None
,
argv
=
None
):
if
argp
is
None
:
...
...
@@ -27,6 +28,7 @@ def main(argp=None, argv=None):
level
=
logging
.
INFO
,
)
start
=
time
.
time
()
while
True
:
with
open
(
argp
.
file
)
as
fh
:
dat
=
fh
.
read
()
...
...
@@ -35,6 +37,10 @@ def main(argp=None, argv=None):
if
match
:
break
if
arp
.
timeout_sec
:
if
(
time
.
time
()
-
start
)
>
argp
.
timeout_sec
:
LOGGER
.
warning
(
'status: match=%s %s=%r'
,
(
match
,
argp
.
literal
),
argp
.
file
,
dat
)
raise
TimeoutError
(
'epoll-then timeout'
)
time
.
sleep
(
argp
.
poll_sec
)
if
argp
.
remainder
:
...
...
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