bare-fs 4.5.0 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/binding.c +36 -3
  2. package/package.json +1 -1
package/binding.c CHANGED
@@ -135,7 +135,8 @@ bare_fs__on_request_result(uv_fs_t *handle) {
135
135
  err = js_create_int32(env, status, &args[1]);
136
136
  assert(err == 0);
137
137
 
138
- js_call_function(env, ctx, on_result, 2, args, NULL);
138
+ err = js_call_function(env, ctx, on_result, 2, args, NULL);
139
+ (void) err;
139
140
 
140
141
  err = js_close_handle_scope(env, scope);
141
142
  assert(err == 0);
@@ -420,6 +421,21 @@ bare_fs_request_result_dirents(js_env_t *env, js_callback_info_t *info) {
420
421
 
421
422
  static void
422
423
  bare_fs__on_open(uv_fs_t *handle) {
424
+ int err;
425
+
426
+ bare_fs_req_t *req = (bare_fs_req_t *) handle;
427
+
428
+ int status = handle->result;
429
+
430
+ if (req->exiting && status >= 0) {
431
+ int fd = status;
432
+
433
+ uv_fs_req_cleanup(handle);
434
+
435
+ err = uv_fs_close(handle->loop, handle, fd, NULL);
436
+ assert(err == 0);
437
+ }
438
+
423
439
  bare_fs__on_request_result(handle);
424
440
  }
425
441
 
@@ -1656,6 +1672,21 @@ bare_fs_symlink_sync(js_env_t *env, js_callback_info_t *info) {
1656
1672
 
1657
1673
  static void
1658
1674
  bare_fs__on_opendir(uv_fs_t *handle) {
1675
+ int err;
1676
+
1677
+ bare_fs_req_t *req = (bare_fs_req_t *) handle;
1678
+
1679
+ int status = handle->result;
1680
+
1681
+ if (req->exiting && status >= 0) {
1682
+ uv_dir_t *dir = handle->ptr;
1683
+
1684
+ uv_fs_req_cleanup(handle);
1685
+
1686
+ err = uv_fs_closedir(handle->loop, handle, dir, NULL);
1687
+ assert(err == 0);
1688
+ }
1689
+
1659
1690
  bare_fs__on_request_result(handle);
1660
1691
  }
1661
1692
 
@@ -1868,7 +1899,8 @@ bare_fs__on_watcher_event(uv_fs_event_t *handle, const char *filename, int event
1868
1899
  memcpy(data, (void *) filename, len);
1869
1900
  }
1870
1901
 
1871
- js_call_function(env, ctx, on_event, 3, args, NULL);
1902
+ err = js_call_function(env, ctx, on_event, 3, args, NULL);
1903
+ (void) err;
1872
1904
 
1873
1905
  err = js_close_handle_scope(env, scope);
1874
1906
  assert(err == 0);
@@ -1915,7 +1947,8 @@ bare_fs__on_watcher_close(uv_handle_t *handle) {
1915
1947
  err = js_delete_reference(env, watcher->ctx);
1916
1948
  assert(err == 0);
1917
1949
 
1918
- js_call_function(env, ctx, on_close, 0, NULL, NULL);
1950
+ err = js_call_function(env, ctx, on_close, 0, NULL, NULL);
1951
+ (void) err;
1919
1952
 
1920
1953
  err = js_close_handle_scope(env, scope);
1921
1954
  assert(err == 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-fs",
3
- "version": "4.5.0",
3
+ "version": "4.5.1",
4
4
  "description": "Native file system operations for Javascript",
5
5
  "exports": {
6
6
  "./package": "./package.json",