Skip to content

SSHDriver fails to launch commands in the background #1658

Description

@adrian-martin

Hi all,

I want to report an issue that I'm facing with the following Python code and the version v24.0.3 of Labgrid:

from labgrid.protocol.commandprotocol import CommandProtocol
from datetime import datetime

def execute_sleep(cmd_driver: CommandProtocol):
    print(f"Start: {datetime.now()}")
    cmd_driver.run("sleep 10 &")
    print(f"End: {datetime.now()}")

While the ShellDriver works as expected when a command is launched in the background:

>>> shell_driver = target.get_driver('ShellDriver')
>>> target.activate(shell_driver)
>>> execute_sleep(shell_driver)
Start: 2025-05-19 18:33:46.764554
End: 2025-05-19 18:33:47.545368
>>> 

The SSHDriver doesn't, always launching them in the foreground:

>>> ssh_driver = target.get_driver('SSHDriver')
>>> target.activate(ssh_driver)
>>> execute_sleep(ssh_driver)
Start: 2025-05-19 18:34:36.748644
End: 2025-05-19 18:34:46.782989
>>> 

This limitation can easily be bypassed by executing the blocking SSH command in a separate thread, but there is a consistency problem with the implementations of the CommandProtocol regarding the commands attempted to be executed in the background.

Just for completion, I found this pull request draft which seems to be working on something similar, but it looks more complex than what I wanted to report, so I decided to open the issue.

Best regards, Adrián

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions