File tree Expand file tree Collapse file tree 2 files changed +10
-17
lines changed
Expand file tree Collapse file tree 2 files changed +10
-17
lines changed Original file line number Diff line number Diff line change @@ -540,34 +540,27 @@ var WasiLibrary = {
540540 return 0 ;
541541 } ,
542542
543+ fd_sync__async : true ,
543544 fd_sync : ( fd ) => {
544545#if SYSCALLS_REQUIRE_FILESYSTEM
545546 var stream = SYSCALLS . getStreamFromFD ( fd ) ;
547+ var rtn = stream . stream_ops . fsync ?. ( stream ) ;
546548#if ASYNCIFY
547- return Asyncify . handleSleep ( ( wakeUp ) => {
548- var mount = stream . node . mount ;
549- if ( ! mount . type . syncfs ) {
550- // We write directly to the file system, so there's nothing to do here.
551- wakeUp ( 0 ) ;
552- return ;
549+ var mount = stream . node . mount ;
550+ if ( mount . type . syncfs ) {
551+ return Asyncify . handleSleep ( ( wakeUp ) => {
552+ mount . type . syncfs ( mount , false , ( err ) => wakeUp ( err ? { { { cDefs. EIO } } } : 0 ) ) ;
553553 }
554- mount . type . syncfs ( mount , false , ( err ) => {
555- wakeUp ( err ? { { { cDefs. EIO } } } : 0 ) ;
556- } ) ;
557- } ) ;
558- #else
559- if ( stream . stream_ops ?. fsync ) {
560- return stream . stream_ops . fsync ( stream ) ;
561554 }
562- return 0 ; // we can't do anything synchronously; the in-memory FS is already synced to
555+ #endif
556+ return rtn ;
563557#endif // ASYNCIFY
564558#elif ASSERTIONS
565559 abort ( 'fd_sync called without SYSCALLS_REQUIRE_FILESYSTEM' ) ;
566560#else
567561 return { { { cDefs . ENOSYS } } } ;
568562#endif // SYSCALLS_REQUIRE_FILESYSTEM
569563 } ,
570- fd_sync__async: true ,
571564
572565 // random.h
573566
Original file line number Diff line number Diff line change 11{
2- "a.out.js" : 245482 ,
2+ "a.out.js" : 245471 ,
33 "a.out.nodebug.wasm" : 573657 ,
4- "total" : 819139 ,
4+ "total" : 819128 ,
55 "sent" : [
66 " IMG_Init" ,
77 " IMG_Load" ,
You can’t perform that action at this time.
0 commit comments