- err(1, "kevent(sf)");
-
- bzero(&kv, sizeof(struct kevent));
- kv.ident = fdin;
- kv.filter = EVFILT_READ;
- kv.flags = EV_ADD;
- if (kevent(kq, &kv, 1, NULL, 0, NULL) == -1)
- err(1, "kevent(sf)");
+ err(1, "kevent(sf %d)", sf);
+
+ /*
+ * We can only read from an interactive terminal
+ */
+ if (isatty(fdin)) {
+ bzero(&kv, sizeof(struct kevent));
+ kv.ident = fdin;
+ kv.filter = EVFILT_READ;
+ kv.flags = EV_ADD;
+ if (kevent(kq, &kv, 1, NULL, 0, NULL) == -1)
+ err(1, "kevent(fdin %d)", fdin);
+ }