8000 WIP: py-terminal plugin by antocuni · Pull Request #1771 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content

WIP: py-terminal plugin #1771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improve the comments
  • Loading branch information
antocuni committed Sep 29, 2023
commit e333813fa1fa19b07fef73df94e1d7db3516d423
7 changes: 4 additions & 3 deletions pyscript.core/src/plugins/pyterminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ addEventListener("py:ready", (event) => {
xworker.sync.pyterminal_write = t.write;

// XXX: I know that the following lines don't work, but this is more or
// lesswhat I would like to happen
pyScript.io.stdout = (s, ...rest) => {
// less what I would like to happen
const something = ???;
something.io.stdout = (s, ...rest) => {
// this is JS code, and we cannot send arbitrary JS code from the main
// to the worker. So maybe a solution is to hardcode this logic
// directly inside the worker code?
xworker.sync.pyterminal_write(s);
}
pyScript.io.stderr = (s, ...rest) => {
something.io.stderr = (s, ...rest) => {
xworker.sync.pyterminal_write(s);
}
something.runPython(`
Expand Down
0