You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by gi...@git.apache.org on 2017/10/05 14:16:57 UTC

[GitHub] mrutkows commented on a change in pull request #588: Fixing concurrent access to single zip file

mrutkows commented on a change in pull request #588: Fixing concurrent access to single zip file
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/588#discussion_r142949714
 
 

 ##########
 File path: utils/gitreader.go
 ##########
 @@ -44,37 +47,47 @@ func NewGitReader(projectName string, record DependencyRecord) *GitReader {
 	gitReader.Url = record.BaseRepo
 	gitReader.Version = record.Version
 	gitReader.ProjectPath = record.ProjectPath
+	gitReader.packageName = record.Packagename
 
 	return &gitReader
 
 }
 
 func (reader *GitReader) CloneDependency() error {
-	zipFileName := reader.Name + "." + reader.Version + ".zip"
+
+	zipFilePrefix := reader.Name + "." + reader.Version + ".zip."
 	zipFilePath := reader.Url + "/zipball" + "/" + reader.Version
 
-	os.MkdirAll(reader.ProjectPath, os.ModePerm)
-	output, err := os.Create(path.Join(reader.ProjectPath, zipFileName))
+	projectPath := reader.ProjectPath
+	os.MkdirAll(projectPath, os.ModePerm)
+
+	zipFile, err := ioutil.TempFile(projectPath, zipFilePrefix)
 
 Review comment:
   Good find!  "Multiple programs calling TempFile simultaneously will not choose the same file. The caller can use f.Name() to find the pathname of the file."
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services