Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
shinohara-rin committed May 3, 2024
1 parent b959938 commit 5276b9b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
23 changes: 12 additions & 11 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31123,17 +31123,18 @@ function setup_sshkey(pubkey, qemu_process, ready_callback) {
qemu_process.stdin.write("root\n");
qemu_process.stdin.write(`cat > /root/.ssh/authorized_keys <<<"${pubkeyContent}"\n`);
qemu_process.stdin.write(`cat /root/.ssh/authorized_keys`);
let waitForKey = (() => {
let concat = ''
return (data) => {
concat += data.toString()
if (concat.includes(pubkeyContent)) {
ready_callback(qemu_process)
waitForKey = () => { }
}
}
})()
qemu_process.stdout.on('data', waitForKey);
setTimeout(() => { ready_callback(qemu_process) }, 2000);
// let waitForKey = (() => {
// let concat = ''
// return (data) => {
// concat += data.toString()
// if (concat.includes(pubkeyContent)) {
// ready_callback(qemu_process)
// waitForKey = () => { }
// }
// }
// })()
// qemu_process.stdout.on('data', waitForKey);
}

function ensure_install_deps() {
Expand Down
23 changes: 12 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,18 @@ function setup_sshkey(pubkey, qemu_process, ready_callback) {
qemu_process.stdin.write("root\n");
qemu_process.stdin.write(`cat > /root/.ssh/authorized_keys <<<"${pubkeyContent}"\n`);
qemu_process.stdin.write(`cat /root/.ssh/authorized_keys`);
let waitForKey = (() => {
let concat = ''
return (data) => {
concat += data.toString()
if (concat.includes(pubkeyContent)) {
ready_callback(qemu_process)
waitForKey = () => { }
}
}
})()
qemu_process.stdout.on('data', waitForKey);
setTimeout(() => { ready_callback(qemu_process) }, 2000);
// let waitForKey = (() => {
// let concat = ''
// return (data) => {
// concat += data.toString()
// if (concat.includes(pubkeyContent)) {
// ready_callback(qemu_process)
// waitForKey = () => { }
// }
// }
// })()
// qemu_process.stdout.on('data', waitForKey);
}

function ensure_install_deps() {
Expand Down

0 comments on commit 5276b9b

Please sign in to comment.