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

Commit268c6ee

Browse files
committed
send background commands
1 parent058e250 commit268c6ee

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

‎packages/runtime/index.html

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,30 +56,27 @@
5656

5757
varemulator=newV86Starter(options);
5858

59+
functioninitTerm(){
60+
constfitAddon=newFitAddon.FitAddon();
61+
emulator.serial_adapter.term.loadAddon(fitAddon);
62+
fitAddon.fit();
63+
window.addEventListener("resize",()=>fitAddon.fit());
64+
}
65+
66+
functionsendBackgroundCommands(commands){
67+
constfilename=`${(Math.random()+1).toString(36).substring(7)}.sh`
68+
emulator.create_file(`/inbox/${filename}`,(newTextEncoder('UTF-8')).encode(commands.join("\n")));
69+
}
70+
5971
if(!boot){
6072
emulator.add_listener("emulator-ready",function(){
61-
constfitAddon=newFitAddon.FitAddon();
62-
emulator.serial_adapter.term.loadAddon(fitAddon);
63-
fitAddon.fit();
64-
window.addEventListener("resize",()=>fitAddon.fit());
65-
// emulator.serial_adapter.term.setOption("allowTransparency", true);
66-
// emulator.serial_adapter.term.setOption("theme", { background: "transparent" });
73+
initTerm();
6774
setTimeout(()=>{
68-
emulator.serial0_send('/etc/init.d/S40network restart\n');
69-
emulator.serial0_send('psql -U postgres\n');
70-
emulator.serial0_send('\\! echo "boot_completed"; reset\n');
75+
sendBackgroundCommands(["/etc/init.d/S40network restart"]);
76+
emulator.serial0_send('\\! reset\n');
77+
emulator.serial_adapter.term.focus();
7178
},0);
7279
});
73-
74-
functionhandleBoot(line){
75-
if(line.startsWith("postgres=# boot_completed")){
76-
emulator.remove_listener(handleBoot);
77-
setTimeout(()=>{
78-
emulator.serial_adapter.term.focus();
79-
},300);
80-
}
81-
}
82-
emulator.add_listener("serial0-output-line",handleBoot);
8380
}
8481

8582
varstate;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp