node-pty 0.11.0-beta27 → 0.11.0-beta28

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": "0.11.0-beta27",
7
+ "version": "0.11.0-beta28",
8
8
  "license": "MIT",
9
9
  "main": "./lib/index.js",
10
10
  "types": "./typings/node-pty.d.ts",
package/src/unix/pty.cc CHANGED
@@ -178,18 +178,23 @@ NAN_METHOD(PtyFork) {
178
178
  bool closeFDs = Nan::To<bool>(info[8]).FromJust();
179
179
  bool explicitlyCloseFDs = closeFDs && !HAVE_POSIX_SPAWN_CLOEXEC_DEFAULT;
180
180
 
181
+ // helperPath
182
+ Nan::Utf8String helper_path_(info[11]);
183
+ char *helper_path = strdup(*helper_path_);
184
+
181
185
  // args
182
186
  v8::Local<v8::Array> argv_ = v8::Local<v8::Array>::Cast(info[1]);
183
187
 
184
- const int EXTRA_ARGS = 5;
188
+ const int EXTRA_ARGS = 6;
185
189
  int argc = argv_->Length();
186
190
  int argl = argc + EXTRA_ARGS + 1;
187
191
  char **argv = new char*[argl];
188
- argv[0] = strdup(*cwd_);
189
- argv[1] = strdup(std::to_string(uid).c_str());
190
- argv[2] = strdup(std::to_string(gid).c_str());
191
- argv[3] = strdup(explicitlyCloseFDs ? "1": "0");
192
- argv[4] = strdup(*file);
192
+ argv[0] = strdup(helper_path);
193
+ argv[1] = strdup(*cwd_);
194
+ argv[2] = strdup(std::to_string(uid).c_str());
195
+ argv[3] = strdup(std::to_string(gid).c_str());
196
+ argv[4] = strdup(explicitlyCloseFDs ? "1": "0");
197
+ argv[5] = strdup(*file);
193
198
  argv[argl - 1] = NULL;
194
199
  for (int i = 0; i < argc; i++) {
195
200
  Nan::Utf8String arg(Nan::Get(argv_, i).ToLocalChecked());
@@ -241,10 +246,6 @@ NAN_METHOD(PtyFork) {
241
246
  cfsetispeed(term, B38400);
242
247
  cfsetospeed(term, B38400);
243
248
 
244
- // helperPath
245
- Nan::Utf8String helper_path_(info[11]);
246
- char *helper_path = strdup(*helper_path_);
247
-
248
249
  sigset_t newmask, oldmask;
249
250
  int flags = POSIX_SPAWN_USEVFORK;
250
251
 
@@ -287,7 +288,7 @@ NAN_METHOD(PtyFork) {
287
288
 
288
289
  { // suppresses "jump bypasses variable initialization" errors
289
290
  pid_t pid;
290
- auto error = posix_spawn(&pid, helper_path, &acts, &attrs, argv, env);
291
+ auto error = posix_spawn(&pid, argv[0], &acts, &attrs, argv, env);
291
292
 
292
293
  close(comms_pipe[1]);
293
294
 
@@ -36,12 +36,12 @@ int main (int argc, char** argv) {
36
36
  close(open(slave_path, O_RDWR));
37
37
  #endif
38
38
 
39
- char *cwd = argv[0];
40
- int uid = std::stoi(argv[1]);
41
- int gid = std::stoi(argv[2]);
42
- bool closeFDs = std::stoi(argv[3]);
43
- char *file = argv[4];
44
- argv = &argv[4];
39
+ char *cwd = argv[1];
40
+ int uid = std::stoi(argv[2]);
41
+ int gid = std::stoi(argv[3]);
42
+ bool closeFDs = std::stoi(argv[4]);
43
+ char *file = argv[5];
44
+ argv = &argv[5];
45
45
 
46
46
  fcntl(COMM_PIPE_FD, F_SETFD, FD_CLOEXEC);
47
47