code == EEXIST
This commit is contained in:
		
							parent
							
								
									948db7588e
								
							
						
					
					
						commit
						797045350f
					
				
							
								
								
									
										
											BIN
										
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -50,12 +50,11 @@ async function write(directory: string, settings: string) { | ||||
|   try { | ||||
|     return fs.writeFileSync(location, settings, options); | ||||
|   } catch (e) { | ||||
|     if (e.code == fs.constants.O_EXCL) { | ||||
|     if (e.code == "EEXIST") { | ||||
|       console.log(`overwriting existing file ${location}`); | ||||
|       // default flag is 'w'
 | ||||
|       return fs.writeFileSync(location, settings, {encoding: 'utf-8'}); | ||||
|     } | ||||
|     console.log(`error ${JSON.stringify(e)} and O_EXCL ${fs.constants.O_EXCL}`); | ||||
|     throw e; | ||||
|   } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user