Commits

Anonymous committed c5930e6

ok, it's really really really solved this time, i promise

  • Participants
  • Parent commits 6a40031

Comments (0)

Files changed (1)

 			erase_usr();
 			for (rdlen = read(mfd, buf, sizeof(buf)); rdlen > 0; rdlen = read(mfd, buf, sizeof(buf)))
 				my_write(STDOUT, buf, rdlen);
-			if (rdlen < 0)
+			if (rdlen < 0 && errno != EAGAIN)
 				warn("failed to read from fd %d", mfd);
 			print_usr();
 		}
 		err(1, "failed execvp %s", argv[i]);
 	}
 
+	if ((i = fcntl(mfd, F_GETFL)) < 0)
+	    err(1, "failed to get fcntl flags from mfd");
+	if (fcntl(mfd, F_SETFL, i | O_NONBLOCK) < 0)
+	    err(1, "failed to set fcntl flags for mfd");
+
 	// read one character at a time;
 	set.c_lflag    &= ~(ICANON | ECHO);
 	set.c_cc[VMIN ] = 1;