Allow sending messages by directly providing them as a ssh commandline argument, by reading process.command
This commit is contained in:
parent
00b73bfa46
commit
aca4f8c0be
1 changed files with 18 additions and 12 deletions
|
@ -55,6 +55,12 @@ async def handle_connection(process: asyncssh.SSHServerProcess):
|
|||
connected_msg = f"[connected] {username}\n"
|
||||
stderr.write(connected_msg)
|
||||
broadcast(connected_msg, True)
|
||||
if process.command is not None:
|
||||
line = process.command.strip("\r\n")
|
||||
msg = f"{username}: {line}\n"
|
||||
stdout.write(msg)
|
||||
broadcast(msg)
|
||||
else:
|
||||
while True:
|
||||
try:
|
||||
async for line in process.stdin:
|
||||
|
|
Reference in a new issue