Closed Alkarex closed 4 months ago
Fix for Error: spawnSync /bin/sh ENOBUFS when the data returned by the Python script is too large.
Error: spawnSync /bin/sh ENOBUFS
Inspired by https://stackoverflow.com/questions/63796633/spawnsync-bin-sh-enobufs
Test Python script:
def generate_large_string(): large_string = 'A' * 5000000 return large_string result = generate_large_string() print(result)
Test JavaScript function;
msg.payload = msg.payload.length; return msg;
Thank you @Alkarex ! I read your code and tried the flow.
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.
Fix for
Error: spawnSync /bin/sh ENOBUFS
when 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
```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" ] ] } ] ```