You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
### Changed
3
3
-**BREAKING** Default python path changed back to `python` on Windows. [#237](https://github.com/extrabacon/python-shell/issues/237)
4
4
-**BREAKING**`error` event renamed to `pythonError` event. [#118](https://github.com/extrabacon/python-shell/issues/118)
5
+
-**BREAKING**`receive` methods removed in favor of `splitter` arguments in the constructor. This lets the default splitting logic reside in a reuseable stream transformer. Now if you have extra pipes you can reuse `newlineTransformer` to split incoming data into newline-seperated lines.
5
6
6
7
### Added
7
8
-`error` event that is fired upon failure to launch process, among other things. [#118](https://github.com/extrabacon/python-shell/issues/118)
Parses incoming data from the Python script written via stdout and emits `message` events. This method is called automatically as data is being received from stdout.
275
-
276
-
#### `.receiveStderr(data)`
277
-
278
-
Parses incoming logs from the Python script written via stderr and emits `stderr` events. This method is called automatically as data is being received from stderr.
279
-
280
274
#### `.end(callback)`
281
275
282
276
Closes the stdin stream, allowing the Python script to finish and exit. The optional callback is invoked when the process is terminated.
@@ -287,7 +281,7 @@ Terminates the python script. A kill signal may be provided by `signal`, if `sig
287
281
288
282
#### event: `message`
289
283
290
-
Fires when a chunk of data is parsed from the stdout stream via the `receive` method. If a `parser` method is specified, the result of this function will be the message value. This event is not emitted in binary mode.
284
+
After the stdout stream is split into chunks by stdoutSplitter the chunks are parsed by the parser and a message event is emitted for each parsed chunk. This event is not emitted in binary mode.
291
285
292
286
Example:
293
287
@@ -307,7 +301,7 @@ shell.on('message', function (message) {
307
301
308
302
#### event: `stderr`
309
303
310
-
Fires when a chunk of logs is parsed from the stderr stream via the `receiveStderr` method. If a `stderrParser` method is specified, the result of this function will be the message value. This event is not emitted in binary mode.
304
+
After the stderr stream is split into chunks by stderrSplitter the chunks are parsed by the parser and a message event is emitted for each parsed chunk. This event is not emitted in binary mode.
311
305
312
306
Example:
313
307
@@ -336,6 +330,10 @@ Fires when:
336
330
337
331
If the process could not be spawned please double-check that python can be launched from the terminal.
338
332
333
+
### NewlineTransformer
334
+
335
+
A utility class for splitting stream data into newlines. Used as the default for stdoutSplitter and stderrSplitter if they are unspecified. You can use this class for any extra python streams if you'd like.
336
+
339
337
## Used By:
340
338
341
339
Python-Shell is used by [arepl-vscode](https://github.com/almenon/arepl-vscode), [gitinspector](https://github.com/ejwa/gitinspector), [pyspreadsheet](https://github.com/extrabacon/pyspreadsheet), [AtlantOS Ocean Data QC](https://github.com/ocean-data-qc/ocean-data-qc) and more!
0 commit comments