mirror of
https://github.com/hymkor/lispect.git
synced 2026-09-03 23:57:49 -04:00
README: wrote about (wait PID)
This commit is contained in:
@@ -17,37 +17,42 @@ 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))
|
|
||||||
|
|
||||||
(with-handler
|
(let ((account (car args))
|
||||||
(lambda (c)
|
(password (cadr args))
|
||||||
(format (error-output) "ssh is not found~%")
|
(sshpid nil))
|
||||||
(return-from main nil))
|
|
||||||
(spawn "ssh" account))
|
|
||||||
|
|
||||||
(expect*
|
(with-handler
|
||||||
("[fingerprint])?"
|
(lambda (c)
|
||||||
(sendln "yes")
|
(format (error-output) "ssh is not found~%")
|
||||||
(expect "password: ")
|
(return-from main nil))
|
||||||
(sendln password))
|
(setq sshpid (spawn "ssh" account)))
|
||||||
("password: "
|
|
||||||
(sendln password))
|
|
||||||
(("Connection refused"
|
|
||||||
"Could not resolve hostname")
|
|
||||||
(return-from main nil))
|
|
||||||
(30
|
|
||||||
(format (error-output) "TIME OUT~%")
|
|
||||||
(return-from main nil)))
|
|
||||||
|
|
||||||
(expect*
|
(expect*
|
||||||
("Permission denied"
|
("[fingerprint])?"
|
||||||
(return-from main nil)
|
(sendln "yes")
|
||||||
)
|
(expect "password: ")
|
||||||
("$ "))
|
(sendln password))
|
||||||
(sendln "echo YOU CAN CALL SOME COMMAND HERE")
|
("password: "
|
||||||
(expect "$ ")
|
(sendln password))
|
||||||
(sendln "exit"))
|
(("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
|
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")`
|
||||||
|
|||||||
Reference in New Issue
Block a user