node-pty 1.1.0-beta10 → 1.1.0-beta11

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.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": {
5
5
  "name": "Microsoft Corporation"
6
6
  },
7
- "version": "1.1.0-beta10",
7
+ "version": "1.1.0-beta11",
8
8
  "license": "MIT",
9
9
  "main": "./lib/index.js",
10
10
  "types": "./typings/node-pty.d.ts",
package/src/unix/pty.cc CHANGED
@@ -189,9 +189,22 @@ void SetupExitCallback(Napi::Env env, Napi::Function cb, pid_t pid) {
189
189
  exit_event->signal_code = WTERMSIG(stat_loc);
190
190
  }
191
191
  auto status = tsfn.BlockingCall(exit_event, callback); // In main thread
192
- assert(status == napi_ok);
192
+ switch (status) {
193
+ case napi_closing:
194
+ break;
193
195
 
194
- tsfn.Release();
196
+ case napi_queue_full:
197
+ Napi::Error::Fatal("SetupExitCallback", "Queue was full");
198
+
199
+ case napi_ok:
200
+ if (tsfn.Release() != napi_ok) {
201
+ Napi::Error::Fatal("SetupExitCallback", "ThreadSafeFunction.Release() failed");
202
+ }
203
+ break;
204
+
205
+ default:
206
+ Napi::Error::Fatal("SetupExitCallback", "ThreadSafeFunction.BlockingCall() failed");
207
+ }
195
208
  });
196
209
  }
197
210
 
package/src/win/conpty.cc CHANGED
@@ -107,9 +107,22 @@ void SetupExitCallback(Napi::Env env, Napi::Function cb, pty_baton* baton) {
107
107
  CloseHandle(baton->hOut);
108
108
 
109
109
  auto status = tsfn.BlockingCall(exit_event, callback); // In main thread
110
- assert(status == napi_ok);
110
+ switch (status) {
111
+ case napi_closing:
112
+ break;
111
113
 
112
- tsfn.Release();
114
+ case napi_queue_full:
115
+ Napi::Error::Fatal("SetupExitCallback", "Queue was full");
116
+
117
+ case napi_ok:
118
+ if (tsfn.Release() != napi_ok) {
119
+ Napi::Error::Fatal("SetupExitCallback", "ThreadSafeFunction.Release() failed");
120
+ }
121
+ break;
122
+
123
+ default:
124
+ Napi::Error::Fatal("SetupExitCallback", "ThreadSafeFunction.BlockingCall() failed");
125
+ }
113
126
  });
114
127
  }
115
128