README: wrote about (wait PID)

This commit is contained in:
HAYAMA_Kaoru
2024-12-05 23:41:31 +09:00
parent 1e4995324b
commit 168aa76b2a
+36 -29
View File
@@ -17,37 +17,42 @@ Lispect
(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))
(with-handler
(lambda (c)
(format (error-output) "ssh is not found~%")
(return-from main nil))
(spawn "ssh" account))
(let ((account (car args))
(password (cadr args))
(sshpid nil))
(expect*
("[fingerprint])?"
(sendln "yes")
(expect "password: ")
(sendln password))
("password: "
(sendln password))
(("Connection refused"
"Could not resolve hostname")
(return-from main nil))
(30
(format (error-output) "TIME OUT~%")
(return-from main nil)))
(with-handler
(lambda (c)
(format (error-output) "ssh is not found~%")
(return-from main nil))
(setq sshpid (spawn "ssh" account)))
(expect*
("Permission denied"
(return-from main nil)
)
("$ "))
(sendln "echo YOU CAN CALL SOME COMMAND HERE")
(expect "$ ")
(sendln "exit"))
(expect*
("[fingerprint])?"
(sendln "yes")
(expect "password: ")
(sendln password))
("password: "
(sendln password))
(("Connection refused"
"Could not resolve hostname")
(return-from main nil))
(30
(format (error-output) "TIME OUT~%")
(return-from main nil)))
(expect*
("Permission denied"
(return-from main nil)
)
("$ "))
(sendln "echo YOU CAN CALL SOME COMMAND HERE")
(expect "$ ")
(sendln "exit")
(wait sshpid)
)
)
```
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
- After SEC seconds have elapsed, COMMANDS-FOR-TIMEOUT will be executed
- `(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")`
- Get the value of the environment variable NAME
- `(setenv "NAME" "VALUE")`