Open
Description
Context:
I run a Python script in a browser environment and need advice on how to resubmit it to the Python interpreter after making updates. Here’s how I currently handle it:
Original Script:
print("Hello World!")
while True:
pass
Current Execution Method:
I execute this script in the browser using the following JavaScript code:
await python.terminal(["python", "-i", "-c", code]);
Issue:
After modifying the script, I need to reload and run the updated version. I was considering using the SIGKILL signal to terminate the existing session and then reinitialize it with the new script. However, I discovered that SIGKILL is not supported—only SIGINT is available.
Current Non-Working Code:
python.kernel.signal(SIGKILL); // SIGKILL is not supported
await python.init();
await python.terminal(["python", "-i", "-c", newCode]); // Intended to resubmit the new version
Questions:
- Given that SIGKILL is not supported and only SIGINT is available, how can I effectively terminate the existing Python session and start a new one with the updated script?
- Is adding support for SIGKILL a good approach to this problem?
Metadata
Metadata
Assignees
Labels
No labels