Fix #793, check dist-backup existing before delete
This commit is contained in:
		
							parent
							
								
									9d31da1fe8
								
							
						
					
					
						commit
						a5f15f2319
					
				
					 1 changed files with 6 additions and 4 deletions
				
			
		|  | @ -34,9 +34,11 @@ function download(url) { | |||
|             }); | ||||
| 
 | ||||
|             tarStream.on("close", () => { | ||||
|                 fs.rmdirSync("./dist-backup", { | ||||
|                     recursive: true | ||||
|                 }); | ||||
|                 if (fs.existsSync("./dist-backup")) { | ||||
|                     fs.rmdirSync("./dist-backup", { | ||||
|                         recursive: true | ||||
|                     }); | ||||
|                 } | ||||
|                 console.log("Done"); | ||||
|             }); | ||||
| 
 | ||||
|  | @ -44,7 +46,7 @@ function download(url) { | |||
|                 if (fs.existsSync("./dist-backup")) { | ||||
|                     fs.renameSync("./dist-backup", "./dist"); | ||||
|                 } | ||||
|                 console.log("Done"); | ||||
|                 console.error("Error from tarStream"); | ||||
|             }); | ||||
| 
 | ||||
|             response.pipe(tarStream); | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue