mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
committed by
GitHub
parent
0a1d3bb678
commit
796373cfa6
4
core/package-lock.json
generated
4
core/package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pyscript/core",
|
||||
"version": "0.6.19",
|
||||
"version": "0.6.20",
|
||||
"type": "module",
|
||||
"description": "PyScript",
|
||||
"module": "./index.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
|
||||
|
||||
File diff suppressed because one or more lines are too long
11
core/tests/manual/issue-2246/index.html
Normal file
11
core/tests/manual/issue-2246/index.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<script type="module" src="../../../dist/core.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="py" src="./main.py" terminal worker></script>
|
||||
</body>
|
||||
</html>
|
||||
1
core/tests/manual/issue-2246/main.py
Normal file
1
core/tests/manual/issue-2246/main.py
Normal file
@@ -0,0 +1 @@
|
||||
print(input("What food would you like me to get from the shop? "))
|
||||
Reference in New Issue
Block a user