example.lsp: use (wait PID)

This commit is contained in:
HAYAMA_Kaoru
2024-12-05 12:20:10 +09:00
parent 7b7e0ebccc
commit 48ab76b65b
+9 -4
View File
@@ -3,14 +3,16 @@
(progn
(format (error-output) "Usage: ~A ~A USERNAME@DOMAIN PASSWORD~%" $EXECUTABLE_NAME $PROGRAM_NAME)
(return-from main nil)))
(defglobal account (car args))
(defglobal password (cadr args))
(let ((account (car args))
(password (cadr args))
(sshpid nil))
(with-handler
(lambda (c)
(format (error-output) "ssh is not found~%")
(return-from main nil))
(spawn "ssh" account))
(setq sshpid (spawn "ssh" account)))
(expect*
("[fingerprint])?"
@@ -33,4 +35,7 @@
("$ "))
(sendln "echo YOU CAN CALL SOME COMMAND HERE")
(expect "$ ")
(sendln "exit"))
(sendln "exit")
(wait sshpid)
)
)