Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd8adb48

Browse files
committed
Fix interrupting previous run when awaiting input
1 parent68a0844 commitd8adb48

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎frontend/src/RunCode.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,9 @@ export let interrupt = () => {
6565
};
6666

6767
letfinishedLastRun=Promise.resolve();
68-
letfinishedLastRunResolve;
68+
letfinishedLastRunResolve=()=>{};
6969

7070
exportconstrunCode=async({code, source})=>{
71-
if(bookState.running){
72-
interrupt();
73-
awaitfinishedLastRun;
74-
}
75-
finishedLastRun=newPromise(r=>finishedLastRunResolve=r);
76-
7771
constshell=source==="shell";
7872
if(shell){
7973
if(awaitingInput){
@@ -84,6 +78,12 @@ export const runCode = async ({code, source}) => {
8478
return;
8579
}
8680
}else{
81+
if(bookState.running){
82+
interrupt();
83+
awaitfinishedLastRun;
84+
}
85+
finishedLastRun=newPromise(r=>finishedLastRunResolve=r);
86+
8787
terminalRef.current.clearStdout();
8888
}
8989

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp