@@ -2239,8 +2239,19 @@ static void OpenFileHandle(const FunctionCallbackInfo<Value>& args) {
22392239 CHECK_EQ (argc, 5 );
22402240 FSReqWrapSync req_wrap_sync;
22412241 FS_SYNC_TRACE_BEGIN (open);
2242- int result = SyncCall (env, args[4 ], &req_wrap_sync, " open" ,
2243- uv_fs_open, *path, flags, mode);
2242+ int result;
2243+ if (!SyncCall (env,
2244+ args[4 ],
2245+ &req_wrap_sync,
2246+ " open" ,
2247+ uv_fs_open,
2248+ *path,
2249+ flags,
2250+ mode)
2251+ .To (&result)) {
2252+ // v8 error occurred while setting the context. propagate!
2253+ return ;
2254+ }
22442255 FS_SYNC_TRACE_END (open);
22452256 if (result < 0 ) {
22462257 return ; // syscall failed, no need to continue, error info is in ctx
@@ -2356,8 +2367,20 @@ static void WriteBuffer(const FunctionCallbackInfo<Value>& args) {
23562367 CHECK_EQ (argc, 7 );
23572368 FSReqWrapSync req_wrap_sync;
23582369 FS_SYNC_TRACE_BEGIN (write);
2359- int bytesWritten = SyncCall (env, args[6 ], &req_wrap_sync, " write" ,
2360- uv_fs_write, fd, &uvbuf, 1 , pos);
2370+ int bytesWritten;
2371+ if (!SyncCall (env,
2372+ args[6 ],
2373+ &req_wrap_sync,
2374+ " write" ,
2375+ uv_fs_write,
2376+ fd,
2377+ &uvbuf,
2378+ 1 ,
2379+ pos)
2380+ .To (&bytesWritten)) {
2381+ FS_SYNC_TRACE_END (write, " bytesWritten" , 0 );
2382+ return ;
2383+ }
23612384 FS_SYNC_TRACE_END (write, " bytesWritten" , bytesWritten);
23622385 args.GetReturnValue ().Set (bytesWritten);
23632386 }
@@ -2515,8 +2538,20 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
25152538 uv_buf_t uvbuf = uv_buf_init (buf, len);
25162539 FSReqWrapSync req_wrap_sync (" write" );
25172540 FS_SYNC_TRACE_BEGIN (write);
2518- int bytesWritten = SyncCall (env, args[5 ], &req_wrap_sync, " write" ,
2519- uv_fs_write, fd, &uvbuf, 1 , pos);
2541+ int bytesWritten;
2542+ if (!SyncCall (env,
2543+ args[5 ],
2544+ &req_wrap_sync,
2545+ " write" ,
2546+ uv_fs_write,
2547+ fd,
2548+ &uvbuf,
2549+ 1 ,
2550+ pos)
2551+ .To (&bytesWritten)) {
2552+ FS_SYNC_TRACE_END (write, " bytesWritten" , 0 );
2553+ return ;
2554+ }
25202555 FS_SYNC_TRACE_END (write, " bytesWritten" , bytesWritten);
25212556 args.GetReturnValue ().Set (bytesWritten);
25222557 }
0 commit comments