1. Home
  2. Docs
  3. Manual
  4. Playbook
  5. Command list
  6. RemoteCommand component

RemoteCommand component

Based on the ssh Command pattern, it encapsulates the command to execute a remote session. After the command is executed, the session connection will be automatically ended.
Because it is executed asynchronously, in order to facilitate collaboration with async/await, a JS interface with the same name but lowercase initial is encapsulated. The specific source code is as follows: https://github.com/aoyiduo/woterm/blob/main/woterm/js/async.js
Its reference example:
https://github.com/aoyiduo/woterm/blob/main/private/playbooks/test/TestRemoteCommand.qml

The core code is as follows:

import RemoteCommand 1.0

RemoteCommand {
   id: remote
}

asyncGenerator(function *(){
    Playbook.log("command start.")
    remote.hosts = hosts.text.split(',')
    yield remoteCommand(remote, cmd.text).catch(function(){})
    Playbook.log("command finish.")
})();

The Property list is as follows:
QString command:
[readable / writable], set commands for remote execution.
QString enterSymbols: [readable / writable], sets the enter symbol such as [\r\n] or [\n].