forked from platformio/platformio-core
Use "connect_read_pipe" on Unix
This commit is contained in:
@ -20,6 +20,7 @@ import time
|
|||||||
|
|
||||||
from platformio import fs
|
from platformio import fs
|
||||||
from platformio.compat import (
|
from platformio.compat import (
|
||||||
|
WINDOWS,
|
||||||
create_task,
|
create_task,
|
||||||
get_locale_encoding,
|
get_locale_encoding,
|
||||||
get_running_loop,
|
get_running_loop,
|
||||||
@ -102,16 +103,17 @@ class DebugBaseProcess:
|
|||||||
|
|
||||||
async def _read_stdin_pipe(self):
|
async def _read_stdin_pipe(self):
|
||||||
loop = get_running_loop()
|
loop = get_running_loop()
|
||||||
try:
|
if WINDOWS:
|
||||||
loop.add_reader(
|
|
||||||
sys.stdin.fileno(),
|
|
||||||
lambda: self.stdin_data_received(sys.stdin.buffer.readline()),
|
|
||||||
)
|
|
||||||
except NotImplementedError:
|
|
||||||
while True:
|
while True:
|
||||||
self.stdin_data_received(
|
self.stdin_data_received(
|
||||||
await loop.run_in_executor(None, sys.stdin.buffer.readline)
|
await loop.run_in_executor(None, sys.stdin.buffer.readline)
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
reader = asyncio.StreamReader()
|
||||||
|
protocol = asyncio.StreamReaderProtocol(reader)
|
||||||
|
await loop.connect_read_pipe(lambda: protocol, sys.stdin)
|
||||||
|
while True:
|
||||||
|
self.stdin_data_received(await reader.readline())
|
||||||
|
|
||||||
def stdin_data_received(self, data):
|
def stdin_data_received(self, data):
|
||||||
self._last_activity = time.time()
|
self._last_activity = time.time()
|
||||||
|
@ -64,7 +64,7 @@ class DebugServerProcess(DebugBaseProcess):
|
|||||||
openocd_pipe_allowed = all(
|
openocd_pipe_allowed = all(
|
||||||
[not self.debug_options["port"], "openocd" in server_executable]
|
[not self.debug_options["port"], "openocd" in server_executable]
|
||||||
)
|
)
|
||||||
openocd_pipe_allowed = False
|
# openocd_pipe_allowed = False
|
||||||
if openocd_pipe_allowed:
|
if openocd_pipe_allowed:
|
||||||
args = []
|
args = []
|
||||||
if server["cwd"]:
|
if server["cwd"]:
|
||||||
|
Reference in New Issue
Block a user