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
This commit is contained in:
parent
a92411fa45
commit
152ca85718
|
|
@ -43,12 +43,16 @@
|
||||||
const file = activeFile;
|
const file = activeFile;
|
||||||
if (!file || $playgroundStore.running) return;
|
if (!file || $playgroundStore.running) return;
|
||||||
|
|
||||||
const stdin = $playgroundStore.consoleInput;
|
const stdin = playgroundStore.consumeStdin();
|
||||||
playgroundStore.setConsoleInput('');
|
|
||||||
playgroundStore.setRunning(true);
|
playgroundStore.setRunning(true);
|
||||||
playgroundStore.appendConsole(
|
playgroundStore.appendConsole(
|
||||||
consoleLine('info', `$ run ${file.name} [${codeLanguage}]`)
|
consoleLine('info', `$ run ${file.name} [${codeLanguage}]`)
|
||||||
);
|
);
|
||||||
|
if (!stdin) {
|
||||||
|
playgroundStore.appendConsole(
|
||||||
|
consoleLine('info', '(tanpa stdin — program yang membaca input akan mendapat EOF)')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await compileCode({
|
const res = await compileCode({
|
||||||
|
|
@ -190,7 +194,7 @@
|
||||||
</div>
|
</div>
|
||||||
{:else if activeTab === 'code'}
|
{:else if activeTab === 'code'}
|
||||||
<div class="pg-code-wrap">
|
<div class="pg-code-wrap">
|
||||||
<FileTree onselect={() => activeTab = 'code'} />
|
<FileTree language={codeLanguage} onselect={() => activeTab = 'code'} />
|
||||||
|
|
||||||
<div class="pg-code-main">
|
<div class="pg-code-main">
|
||||||
<div class="pg-code-toolbar">
|
<div class="pg-code-toolbar">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue