Disable idb stdout buffering for logs

Summary:
Changelog: Disable idb stdout buffering for logs. Show logs on iOS devices without buffering.

Currently, idb buffers log output if it's redirected to a non-TTY. It is the default behavior for Python (read more about it [here](https://eklitzke.org/stdout-buffering)).
It leads to users seeing logs only in large chunks because the size of the buffer is substantial.
Setting PYTHONUNBUFFERED to a non-empty string disables Python output buffering.

Reviewed By: lblasa

Differential Revision: D32984711

fbshipit-source-id: 3e0a889b6b60b6d266f4a0c1894db937868c7433
This commit is contained in:
Andrey Goncharov
2021-12-09 09:47:01 -08:00
committed by Facebook GitHub Bot
parent 59641d7987
commit 359e403639
2 changed files with 15 additions and 3 deletions

View File

@@ -70,7 +70,11 @@ export function idbStartLogListener(
return child_process.spawn(
idbPath,
['log', '--udid', udid, '--', ...getLogExtraArgs(deviceType)],
{},
{
env: {
PYTHONUNBUFFERED: '1',
},
},
);
}