Skip to content

Commit e2db402

Browse files
committed
dfvd
1 parent ef1cc7f commit e2db402

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

dist/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31130,13 +31130,14 @@ function setup_sshkey(pubkey, qemu_process, ready_callback) {
3113031130
qemu_process.stdin.write("root\n");
3113131131
let waitForPrompt = waitFor("root@freebsd:", () => {
3113231132
waitForPrompt = () => { }
31133+
let waitForKey = waitFor(pubkeyContent, () => {
31134+
ready_callback(qemu_process)
31135+
})
31136+
qemu_process.stdout.on('data', waitForKey)
3113331137
qemu_process.stdin.write("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n");
3113431138
qemu_process.stdin.write("/etc/rc.d/sshd restart\n");
3113531139
qemu_process.stdin.write(`echo "${pubkeyContent}" > /root/.ssh/authorized_keys\n`);
3113631140
qemu_process.stdin.write(`cat /root/.ssh/authorized_keys\n`);
31137-
let waitForKey = waitFor(pubkeyContent, () => {
31138-
ready_callback(qemu_process)
31139-
})
3114031141
})
3114131142
qemu_process.stdout.on('data', (data) => {
3114231143
waitForPrompt(data)

index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,14 @@ function setup_sshkey(pubkey, qemu_process, ready_callback) {
240240
qemu_process.stdin.write("root\n");
241241
let waitForPrompt = waitFor("root@freebsd:", () => {
242242
waitForPrompt = () => { }
243+
let waitForKey = waitFor(pubkeyContent, () => {
244+
ready_callback(qemu_process)
245+
})
246+
qemu_process.stdout.on('data', waitForKey)
243247
qemu_process.stdin.write("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n");
244248
qemu_process.stdin.write("/etc/rc.d/sshd restart\n");
245249
qemu_process.stdin.write(`echo "${pubkeyContent}" > /root/.ssh/authorized_keys\n`);
246250
qemu_process.stdin.write(`cat /root/.ssh/authorized_keys\n`);
247-
let waitForKey = waitFor(pubkeyContent, () => {
248-
ready_callback(qemu_process)
249-
})
250251
})
251252
qemu_process.stdout.on('data', (data) => {
252253
waitForPrompt(data)

0 commit comments

Comments
 (0)