This repository was archived by the owner on Dec 15, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed
Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -1939,14 +1939,14 @@ class TextBuffer {
19391939 throw error
19401940 }
19411941 } else if ( isWindows ) {
1942- const winattr = require ( 'winattr' )
1943- const attrs = winattr . getSync ( filePath )
1942+ const winattr = getPromisifiedWinattr ( )
1943+ const attrs = await winattr . get ( filePath )
19441944 if ( ! attrs . hidden ) throw error
19451945
19461946 try {
1947- winattr . setSync ( filePath , { hidden : false } )
1947+ await winattr . set ( filePath , { hidden : false } )
19481948 await this . buffer . save ( filePath , this . getEncoding ( ) )
1949- winattr . setSync ( filePath , { hidden : true } )
1949+ await winattr . set ( filePath , { hidden : true } )
19501950 } catch ( _ ) {
19511951 throw error
19521952 }
@@ -2614,4 +2614,18 @@ class SearchCallbackArgument {
26142614 }
26152615}
26162616
2617+ let _winattr = null
2618+ const getPromisifiedWinattr = function ( ) {
2619+ if ( _winattr === null ) {
2620+ const { promisify } = require ( 'util' )
2621+ const winattr = require ( 'winattr' )
2622+ _winattr = {
2623+ set : promisify ( winattr . set ) ,
2624+ get : promisify ( winattr . get )
2625+ }
2626+ }
2627+
2628+ return _winattr
2629+ }
2630+
26172631module . exports = TextBuffer
You can’t perform that action at this time.
0 commit comments