Use spawn instead of exec to support larger output payloads#7
Merged
404background merged 3 commits into404background:mainfrom Jun 26, 2024
Merged
Use spawn instead of exec to support larger output payloads#7404background merged 3 commits into404background:mainfrom
404background merged 3 commits into404background:mainfrom
Conversation
Owner
|
Thank you @Alkarex ! Before your modification, I got an error. With your code, I can run it without any problem! I think it is fine, so I merge this pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fix for
Error: spawnSync /bin/sh ENOBUFSwhen the data returned by the Python script is too large.Inspired by https://stackoverflow.com/questions/63796633/spawnsync-bin-sh-enobufs
Test Python script:
Test JavaScript function;
flows.json
[ { "id": "f14c248431d474e8", "type": "inject", "z": "f6f2187d.f17ca8", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 130, "y": 260, "wires": [ [ "8be43bb7c337f2b3" ] ] }, { "id": "b50cd141069d9975", "type": "debug", "z": "f6f2187d.f17ca8", "name": "debug 1", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 740, "y": 260, "wires": [] }, { "id": "8be43bb7c337f2b3", "type": "venv", "z": "f6f2187d.f17ca8", "name": "", "code": "def generate_large_string():\n\tlarge_string = 'A' * 5000000\n\treturn large_string\n\nresult = generate_large_string()\nprint(result)\n", "x": 350, "y": 260, "wires": [ [ "9dcaea21518426b1" ] ] }, { "id": "9dcaea21518426b1", "type": "function", "z": "f6f2187d.f17ca8", "name": "function 1", "func": "msg.payload = msg.payload.length;\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 540, "y": 260, "wires": [ [ "b50cd141069d9975" ] ] } ]