diff options
author | stephanelsmith <stephane.smith@titansensor.com> | 2023-07-26 02:52:56 +0000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2023-09-01 17:39:38 +1000 |
commit | 1c047742a273382241e8cfddb12a1d8b4f7f59ab (patch) | |
tree | 9736ebbc0ca3b52a10c889d3d37562c87be297ec /tests/io/file_stdio2.py | |
parent | 633599cdd500d3a2c99193f2c4340ac823d1a8a8 (diff) |
extmod/vfs_posix_file: Fix flush handling on macOS.
On macOS, if running micropython from subprocess.check_output, then a
stdout.flush() raises error 45.
Here's a test case. This will run fine on linux, but crashes on macOS with
error 45.
import sys
import subprocess
import tempfile
with tempfile.NamedTemporaryFile('w') as fp:
fp.write('''
import sys
sys.stdout.write('hello world')
sys.stdout.flush()
print('')
''')
fp.flush()
print('py3')
o = subprocess.check_output(f'python3 {fp.name}'.split())
print(o)
print('upy')
o = subprocess.check_output(f'micropython {fp.name}'.split())
print(o)
On macOS:
py3
b'hello world\n'
upy
Traceback (most recent call last):
File "...", line 4, in <module>
OSError: 45
On unix:
py3
b'hello world\n'
upy
b'hello world\n'
Signed-off-by: stephanelsmith <stephane.smith@titansensor.com>
Diffstat (limited to 'tests/io/file_stdio2.py')
0 files changed, 0 insertions, 0 deletions