Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aaron Chen
erp5
Commits
4da38fa2
Commit
4da38fa2
authored
Sep 22, 2014
by
Sebastien Robin
Committed by
Julien Muchembled
Sep 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BT: prevent conflicts when several processes call genbt5list in parallel
Cherry picked from commits:
cacea29b
a4555829
073e3e4b
parent
db6a2d07
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
product/ERP5/bin/genbt5list
product/ERP5/bin/genbt5list
+6
-4
No files found.
product/ERP5/bin/genbt5list
View file @
4da38fa2
...
...
@@ -213,14 +213,16 @@ def main(dir_list=None, **kw):
for
d
in
dir_list
:
bt5list
=
generateInformation
(
d
,
**
kw
).
getvalue
()
d
=
os
.
path
.
join
(
d
,
'bt5list.new'
)
# add pid in filename to avoid conflicts if several process calls genbt5list
destination_path
=
os
.
path
.
join
(
d
,
'bt5list'
)
temporary_path
=
destination_path
+
'.new.%i'
%
os
.
getpid
()
try
:
with
open
(
d
,
'wb'
)
as
f
:
with
open
(
temporary_path
,
'wb'
)
as
f
:
f
.
write
(
bt5list
)
os
.
rename
(
d
,
d
[:
-
4
]
)
os
.
rename
(
temporary_path
,
destination_path
)
finally
:
try
:
os
.
remove
(
d
)
os
.
remove
(
temporary_path
)
except
OSError
:
pass
...
...
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