Re: Initiate command in another shell session?

Liste des GroupesRevenir à cu shell 
Sujet : Re: Initiate command in another shell session?
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.unix.shell
Date : 13. Mar 2025, 17:49:48
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250313093734.372@kylheku.com>
References : 1
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2025-03-13, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
The question occurred to me whether it would be possible to remotely
execute a command as if started from another shell session *in* that
shell session.

The target shell session has to run some service loop listening for
these requests, on a pipe or something.

On top of that you can build remote procedure calls.

Running any command specified by the caller is equivalent to having
"eval" available as a remote procedure call.

Or something lesser: running any simple command (command name
with arguments).  When the function unpacks the arguments,
it can subject them to some validation, checking for allowed
commands or command/argument combinations.

About the service loop, we don't have threads in the popular
shells like Bash.

If it's all one the same machine, you could set a trap for a
signal in the target shell. Then when the caller deposits a
message in the message box (however that is implemented)
it kills that shell with the signal. The trap handler will
then dispatch the RPC.

If the target shell is interactive, you might want it so that
the commands are not immediately dispatched while that shell
is executing code, only when it's ide. (And by the way, when the shell
is suspended waiting for an external command, like an editor to exit, it
won't be able to take RPCs).

The trap handler can check a global flag indicating whether the
shell is idle (OK to dispatch command now) or busy (queue
the command, to be run when it goes out of the busy state).

As you can guess, my thinking here is influenced by having
worked on the Basta extension, which updates the status line
in response to timer signals.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Date Sujet#  Auteur
13 Mar 25 * Initiate command in another shell session?17Janis Papanagnou
13 Mar 25 +* Re: Initiate command in another shell session?6Dan Cross
13 Mar 25 i+- [OT] SunOS issue (historic) (was Re: Initiate command in another shell session?)1Janis Papanagnou
13 Mar 25 i`* Re: Initiate command in another shell session?4Janis Papanagnou
13 Mar 25 i `* Re: Initiate command in another shell session?3Dan Cross
14 Mar 25 i  +- Re: Initiate command in another shell session?1Janis Papanagnou
16 Mar 25 i  `- Re: Initiate command in another shell session?1Jim Diamond
13 Mar 25 +- Re: Initiate command in another shell session?1Kaz Kylheku
13 Mar 25 +- Re: Initiate command in another shell session?1David W. Hodgins
13 Mar 25 +- Re: Initiate command in another shell session?1Christian Weisgerber
14 Mar 25 +* Re: Initiate command in another shell session?6Keith Thompson
14 Mar 25 i+- Re: Initiate command in another shell session?1Kaz Kylheku
14 Mar 25 i+- Re: Initiate command in another shell session?1Dan Cross
14 Mar 25 i`* Re: Initiate command in another shell session?3Christian Weisgerber
14 Mar 25 i `* Re: Initiate command in another shell session?2Kaz Kylheku
15 Mar 25 i  `- Re: Initiate command in another shell session?1Christian Weisgerber
14 Mar 25 `- Re: Initiate command in another shell session?1Janis Papanagnou

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal