diff --git a/core/package-lock.json b/core/package-lock.json index f46809003ba..0fe8f5898ad 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -1,12 +1,12 @@ { "name": "@pyscript/core", - "version": "0.6.19", + "version": "0.6.20", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@pyscript/core", - "version": "0.6.19", + "version": "0.6.20", "license": "APACHE-2.0", "dependencies": { "@ungap/with-resolvers": "^0.1.0", diff --git a/core/package.json b/core/package.json index c012688888a..613b15a156f 100644 --- a/core/package.json +++ b/core/package.json @@ -1,6 +1,6 @@ { "name": "@pyscript/core", - "version": "0.6.19", + "version": "0.6.20", "type": "module", "description": "PyScript", "module": "./index.js", diff --git a/core/src/plugins/py-terminal/py.js b/core/src/plugins/py-terminal/py.js index 3b08acab895..ca35abeebed 100644 --- a/core/src/plugins/py-terminal/py.js +++ b/core/src/plugins/py-terminal/py.js @@ -137,6 +137,18 @@ export default async (element) => { // setup remote thread JS/Python code for whenever the // worker is ready to become a terminal hooks.worker.onReady.add(workerReady); + + // @see https://github.com/pyscript/pyscript/issues/2246 + const patchInput = [ + "import builtins as _b", + "from pyscript import sync as _s", + "_b.input = _s.pyterminal_read", + "del _b", + "del _s", + ].join("\n"); + + hooks.worker.codeBeforeRun.add(patchInput); + hooks.worker.codeBeforeRunAsync.add(patchInput); } else { // in the main case, just bootstrap XTerm without // allowing any input as that's not possible / awkward diff --git a/core/tests/index.html b/core/tests/index.html index ca12533e691..128bce2aa3f 100644 --- a/core/tests/index.html +++ b/core/tests/index.html @@ -14,5 +14,5 @@ a:hover { opacity: 1; } -