Skip to content

Commit b1b06dc

Browse files
author
Thomas Desveaux
committed
process: fix call output capture
1 parent 6d00d09 commit b1b06dc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

nimp/sys/process.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def call(
116116
ProcessOutputStream.STDDBG: debug_pipe.output if debug_pipe else None,
117117
}
118118

119-
all_captures = {
119+
all_captures: dict[ProcessOutputStream, list[str]] = {
120120
ProcessOutputStream.STDOUT: [],
121121
ProcessOutputStream.STDERR: [],
122122
}
@@ -125,7 +125,7 @@ def _capture_output_default(stream: ProcessOutputStream, value: str):
125125
if (capture_array := all_captures.get(stream)) is not None:
126126
capture_array.append(value)
127127

128-
capture_processor = None
128+
capture_processor: Callable[[ProcessOutputStream, str], None] | None = None
129129
if capture_output is True:
130130
capture_processor = _capture_output_default
131131
elif callable(capture_output):
@@ -145,7 +145,7 @@ def _input_worker(in_pipe, data):
145145
in_pipe.write(data)
146146
in_pipe.close()
147147

148-
def _output_worker(index: ProcessOutputStream, decoding_format):
148+
def _output_worker(index: ProcessOutputStream, decoding_format) -> None:
149149
in_pipe = all_pipes[index]
150150
if in_pipe is None:
151151
return
@@ -170,7 +170,7 @@ def _output_worker(index: ProcessOutputStream, decoding_format):
170170
pass
171171

172172
if capture_processor is not None:
173-
capture_processor(line)
173+
capture_processor(index, line)
174174

175175
# Stop reading data from stdout if data has arrived on OutputDebugString
176176
if index == 2:

0 commit comments

Comments
 (0)