Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jean-Paul Smets
slapos
Commits
977179b9
Commit
977179b9
authored
Sep 07, 2011
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add executee_wait function to librecipe
parent
412cf7aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
slapos/recipe/librecipe/execute.py
slapos/recipe/librecipe/execute.py
+19
-0
No files found.
slapos/recipe/librecipe/execute.py
View file @
977179b9
...
@@ -39,6 +39,25 @@ def executee(args):
...
@@ -39,6 +39,25 @@ def executee(args):
env
[
k
]
=
v
env
[
k
]
=
v
os
.
execve
(
exec_list
[
0
],
exec_list
+
sys
.
argv
[
1
:],
env
)
os
.
execve
(
exec_list
[
0
],
exec_list
+
sys
.
argv
[
1
:],
env
)
def
executee_wait
(
args
):
"""Portable execution with process replacement and environment manipulation"""
exec_list
=
list
(
args
[
0
])
file_list
=
list
(
args
[
1
])
environment
=
args
[
2
]
env
=
os
.
environ
.
copy
()
for
k
,
v
in
environment
.
iteritems
():
env
[
k
]
=
v
sleep
=
60
while
True
:
ready
=
True
for
f
in
file_list
:
if
not
os
.
path
.
exists
(
f
):
print
'File %r does not exists, sleeping for %s'
%
(
f
,
sleep
)
ready
=
False
if
ready
:
break
time
.
sleep
(
sleep
)
os
.
execve
(
exec_list
[
0
],
exec_list
+
sys
.
argv
[
1
:],
env
)
def
sig_handler
(
signal
,
frame
):
def
sig_handler
(
signal
,
frame
):
print
'Received signal %r, killing children and exiting'
%
signal
print
'Received signal %r, killing children and exiting'
%
signal
...
...
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