README: wrote about (wait PID)

This commit is contained in:
HAYAMA_Kaoru
2024-12-05 23:41:31 +09:00
parent 1e4995324b
commit 168aa76b2a
+12 -5
View File
@@ -17,14 +17,16 @@ Lispect
(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])?"
@@ -47,7 +49,10 @@ Lispect
("$ ")) ("$ "))
(sendln "echo YOU CAN CALL SOME COMMAND HERE") (sendln "echo YOU CAN CALL SOME COMMAND HERE")
(expect "$ ") (expect "$ ")
(sendln "exit")) (sendln "exit")
(wait sshpid)
)
)
``` ```
Install Install
@@ -92,7 +97,9 @@ Parameters enclosed in curly braces {...} are optional and can be omitted.
- When STRING-n is found on the terminal, COMMANDS-n will be executed - When STRING-n is found on the terminal, COMMANDS-n will be executed
- After SEC seconds have elapsed, COMMANDS-FOR-TIMEOUT will be executed - After SEC seconds have elapsed, COMMANDS-FOR-TIMEOUT will be executed
- `(spawn "COMMANDNAME" "ARG-1" ...)` - `(spawn "COMMANDNAME" "ARG-1" ...)`
- Start the executable file - Start the executable file and it returns Process-ID
- `(wait PID)`
- Wait the process specified with PID
- `(getenv "NAME")` - `(getenv "NAME")`
- Get the value of the environment variable NAME - Get the value of the environment variable NAME
- `(setenv "NAME" "VALUE")` - `(setenv "NAME" "VALUE")`