Skip to content

Commit

Permalink
Merge pull request #285 from Microsoft/tyriar/220_ioctl_error
Browse files Browse the repository at this point in the history
Include error type in resize ioctl call
  • Loading branch information
Tyriar authored May 1, 2019
2 parents bed37ce + 3935c60 commit 575c482
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/unix/pty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,13 @@ NAN_METHOD(PtyResize) {
winp.ws_ypixel = 0;

if (ioctl(fd, TIOCSWINSZ, &winp) == -1) {
return Nan::ThrowError("ioctl(2) failed.");
switch (errno) {
case EBADF: return Nan::ThrowError("ioctl(2) failed, EBADF");
case EFAULT: return Nan::ThrowError("ioctl(2) failed, EFAULT");
case EINVAL: return Nan::ThrowError("ioctl(2) failed, EINVAL");
case ENOTTY: return Nan::ThrowError("ioctl(2) failed, ENOTTY");
}
return Nan::ThrowError("ioctl(2) failed");
}

return info.GetReturnValue().SetUndefined();
Expand Down

0 comments on commit 575c482

Please sign in to comment.