From 152ca8571801fb56360f2f64b92fb379abb49e3e Mon Sep 17 00:00:00 2001 From: a2nr Date: Sat, 1 Aug 2026 22:38:47 +0000 Subject: [PATCH] fix(playground): Run mengonsumsi stdinQueue atomik via consumeStdin() - runActiveFile() memanggil consumeStdin() (antrean + draft, digabung, dikosongkan) - pesan info jika stdin kosong: program yang membaca input akan mendapat EOF - hapus pembacaan consoleInput langsung yang menyebabkan baris hilang --- frontend/src/routes/playground/+page.svelte | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/src/routes/playground/+page.svelte b/frontend/src/routes/playground/+page.svelte index ede1f79..4c0e75b 100644 --- a/frontend/src/routes/playground/+page.svelte +++ b/frontend/src/routes/playground/+page.svelte @@ -43,12 +43,16 @@ const file = activeFile; if (!file || $playgroundStore.running) return; - const stdin = $playgroundStore.consoleInput; - playgroundStore.setConsoleInput(''); + const stdin = playgroundStore.consumeStdin(); playgroundStore.setRunning(true); playgroundStore.appendConsole( consoleLine('info', `$ run ${file.name} [${codeLanguage}]`) ); + if (!stdin) { + playgroundStore.appendConsole( + consoleLine('info', '(tanpa stdin — program yang membaca input akan mendapat EOF)') + ); + } try { const res = await compileCode({ @@ -190,7 +194,7 @@ {:else if activeTab === 'code'}
- activeTab = 'code'} /> + activeTab = 'code'} />