sony / flutter-elinux

Flutter tools for embedded Linux (eLinux)
BSD 3-Clause "New" or "Revised" License
424 stars 43 forks source link

custom-device: add customizable stopApp command #202

Closed HidenoriMatsubayashi closed 1 year ago

HidenoriMatsubayashi commented 1 year ago

This change adds stopApp command to custom-devices json file to quit flutter app from host PC remotely.

~/.flutter_custom_devices.json example:

{
  "custom-devices": [
    {
      "id": "raspberry-pi4",
      "label": "Rasberry Pi 4",
      "sdkNameAndVersion": "Rasberry Pi 4",
      "enabled": true,
      "platform": "arm64",
      "backend": "wayland",
      "ping": [
        "ping", "-w", "500", "-c", "1", "192.168.10.22"
      ],
      "pingSuccessRegex": "ttl=",
      "install": [
        "scp", "-r", "${localPath}", "hidenori@192.168.10.22:/tmp/${appName}"
      ],
      "uninstall": [
        "ssh", "hidenori@192.168.10.22", "rm -rf \"/tmp/${appName}\""
      ],
      "runDebug": [
        "ssh", "hidenori@192.168.10.22", "/tmp/${appName}/${appName} -b ."
      ],
      "stopApp": [
        "ssh", "hidenori@192.168.10.22",
        "ps aux | grep \"/tmp/${appName}\" | grep -v grep | awk '{print $2}' | xargs kill"
      ],
      "forwardPort": [
        "ssh", "-o", "ExitOnForwardFailure=yes",
        "-L", "127.0.0.1:${hostPort}:127.0.0.1:${devicePort}", "hidenori@192.168.10.22"
      ],
      "forwardPortSuccessRegex": "Linux"
    }
  ]
}

Fixed #157