Ferreteria/v0.6/sys/Connx/run
|
Ferreteria: process-management subsystem
|
About
- Purpose: We need to have an abstract model for running executables in different contexts (mainly: local vs. remote, where the latter mainly means "via ssh"), so that the control-code doesn't need to know anything about where the executable is.
Process Control Modeling
The ssh2 library and the local process library have significantly different approaches to managing processes.
- In SSH2, you first open the session (
ssh2_connect()) to get a session-resource, and then you send commands (ssh2_exec()) via that resource.- You can also open a shell (
ssh2_shell()) for further commands, though it's unclear what the difference is.
- You can also open a shell (
- In proc, a process starts with a command. The command can then be left running to receive additional data, which will be interpreted by the initial command.
However, in order to have a consistent API, we need to provide functions for each of the steps that either type of connection needs. For those that aren't used by a particular type, the function is basically stubbed off as a no-op.
| Details: | API | Proc | SSH2 | ||
|---|---|---|---|---|---|
| Model Action | Starter
|
Session
|
Starter
|
Session
| |
| Open | Session->Connectify()
|
NO OP | create Session object | ssh2_connect()
| |
| Run | Session->StartProcess() | proc_open()
|
send to stdin |
forward to Session object | ssh2_exec()
|
| recv | Session->OExecLecture | stdout | |||
| send | Session->OExecRespond | stdin | |||
| Shut | Session->ActualShut() | proc_close() |
zap Session object | ssh2_disconnect()
| |
- "recv" = receive output from the running process / "send" = send additional data/commands to the running process
- stdin/stdout: see I/O streams