Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0e351f3

Browse files
committed
Finally found a wat to set a file nonblocking that works on Irix,
Solaris and Linux: use os.O_NONBLOCK.
1 parent d776362 commit 0e351f3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/test/test_fcntl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212

1313
# the example from the library docs
1414
f = open(filename,'w')
15-
rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETFL, FCNTL.FNDELAY)
15+
rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETFL, os.O_NONBLOCK)
1616
if verbose:
17-
print 'Status from fnctl with O_NDELAY: ', rv
17+
print 'Status from fnctl with O_NONBLOCK: ', rv
1818

1919
lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0)
2020
if verbose:

0 commit comments

Comments
 (0)