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 (progn
(format (error-output) "Usage: ~A ~A USERNAME@DOMAIN PASSWORD~%" $EXECUTABLE_NAME $PROGRAM_NAME) (format (error-output) "Usage: ~A ~A USERNAME@DOMAIN PASSWORD~%" $EXECUTABLE_NAME $PROGRAM_NAME)
(return-from main nil))) (return-from main nil)))
(defglobal account (car args))
(defglobal password (cadr args)) (let ((account (car args))
(password (cadr args))
(sshpid nil))
(with-handler (with-handler
(lambda (c) (lambda (c)
(format (error-output) "ssh is not found~%") (format (error-output) "ssh is not found~%")
(return-from main nil)) (return-from main nil))
(spawn "ssh" account)) (setq sshpid (spawn "ssh" account)))
(expect* (expect*
("[fingerprint])?" ("[fingerprint])?"
@@ -33,4 +35,7 @@
("$ ")) ("$ "))
(sendln "echo YOU CAN CALL SOME COMMAND HERE") (sendln "echo YOU CAN CALL SOME COMMAND HERE")
(expect "$ ") (expect "$ ")
(sendln "exit")) (sendln "exit")
(wait sshpid)
)
)