Date: Thu, 07 Sep 2017 20:41:16 +0000 From: bugzilla-noreply@freebsd.org To: python@FreeBSD.org Subject: [Bug 222112] lang/python36 selectors.select() does not block on named pipes / mkfifo Message-ID: <bug-222112-21822-r2Q66O8TIH@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-222112-21822@https.bugs.freebsd.org/bugzilla/> References: <bug-222112-21822@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D222112 --- Comment #2 from Jeff Kletsky <jeff+freebsd@wagsky.com> --- @tobic code, for anyone that finds this through search: After opening the FIFO for reading, open it again for writing to prevent yo= ur program from ever seeing EOF at all (i.e. pretend there is always at least 1 writer). There is no need to use select() here; readline() will already blo= ck and wait for new data. Code: import logging def test(): command_pipe =3D 'commands-in' logging.basicConfig(level=3Dlogging.INFO) logger =3D logging.getLogger() logger.info(f"Opening command pipe: '{command_pipe}'") with open(command_pipe, "r") as cp, open(command_pipe, "w"): while True: line =3D cp.readline() logger.info(f"Read: '{line}'") if __name__ =3D=3D '__main__': test() --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-222112-21822-r2Q66O8TIH>