* Sends a message to the Python shell through stdin * Override this method to format data to be sent to the Python process * @returns {PythonShell} The same instance for chaining calls
(message: string | Object)
| 391 | * @returns {PythonShell} The same instance for chaining calls |
| 392 | */ |
| 393 | send(message: string | Object) { |
| 394 | if (!this.stdin) throw new Error("stdin not open for writing"); |
| 395 | let data = this.formatter ? this.formatter(message) : message; |
| 396 | if (this.mode !== 'binary') data += newline; |
| 397 | this.stdin.write(data); |
| 398 | return this; |
| 399 | }; |
| 400 | |
| 401 | /** |
| 402 | * Closes the stdin stream. Unless python is listening for stdin in a loop |