Commit a948f7d
authored
Improve subprocess text handling and type safety (#485)
- BREAKING: Switch run() to use text=True by default for subprocess commands
- Now uses unicode instead of bytes for subprocess commands
- Removes console_to_str() helper function and related encoding logic
- Removes universal_newlines and text parameters from run()
- Improve type safety:
- Replace StrOrBytesPath with StrPath for better type consistency
- Fix args type handling in CommandError to properly handle string vs sequence inputs
- Add proper None checks for stdout/stderr handling
- Update type hints in subprocess.py for text parameter
- Code cleanup:
- Simplify output handling logic
- Remove redundant string conversions
- Improve error message formatting
Note: This is a breaking change. Users experiencing compatibility issues
should file a ticket.3 files changed
+39
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
18 | 26 | | |
19 | 27 | | |
20 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 25 | | |
38 | 26 | | |
39 | 27 | | |
| |||
99 | 87 | | |
100 | 88 | | |
101 | 89 | | |
102 | | - | |
103 | | - | |
| 90 | + | |
| 91 | + | |
104 | 92 | | |
105 | 93 | | |
106 | | - | |
| 94 | + | |
107 | 95 | | |
108 | 96 | | |
109 | 97 | | |
110 | 98 | | |
111 | 99 | | |
112 | 100 | | |
113 | | - | |
| 101 | + | |
114 | 102 | | |
115 | 103 | | |
116 | 104 | | |
117 | 105 | | |
118 | 106 | | |
119 | 107 | | |
120 | | - | |
| 108 | + | |
121 | 109 | | |
122 | | - | |
123 | 110 | | |
124 | 111 | | |
125 | 112 | | |
126 | 113 | | |
127 | 114 | | |
128 | 115 | | |
129 | | - | |
130 | 116 | | |
131 | 117 | | |
132 | 118 | | |
| |||
191 | 177 | | |
192 | 178 | | |
193 | 179 | | |
194 | | - | |
195 | 180 | | |
196 | 181 | | |
197 | 182 | | |
198 | 183 | | |
199 | 184 | | |
200 | | - | |
| 185 | + | |
201 | 186 | | |
202 | 187 | | |
203 | 188 | | |
| |||
206 | 191 | | |
207 | 192 | | |
208 | 193 | | |
209 | | - | |
| 194 | + | |
210 | 195 | | |
211 | 196 | | |
212 | 197 | | |
| |||
220 | 205 | | |
221 | 206 | | |
222 | 207 | | |
223 | | - | |
| 208 | + | |
224 | 209 | | |
225 | 210 | | |
226 | 211 | | |
227 | 212 | | |
228 | 213 | | |
229 | | - | |
230 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
231 | 220 | | |
232 | | - | |
233 | | - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
234 | 227 | | |
235 | 228 | | |
236 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
237 | 236 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
| 261 | + | |
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
| |||
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
373 | | - | |
| 373 | + | |
374 | 374 | | |
375 | 375 | | |
376 | 376 | | |
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
487 | | - | |
| 487 | + | |
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
| |||
0 commit comments