custom-device: add customizable stopApp command (#202)
This change adds `stopApp` command to custom-devices json file to quit flutter app from host PC remotely. Fixed #157 Signed-off-by: Hidenori Matsubayashi <[email protected]>
This commit is contained in:
@@ -255,6 +255,21 @@ class ELinuxDevice extends Device {
|
||||
{String? userIdentifier}) async {
|
||||
_maybeUnforwardPort();
|
||||
|
||||
// Stop app for remote devices.
|
||||
if (!_desktop && _config!.stopAppCommand.isNotEmpty) {
|
||||
final List<String> interpolated = interpolateCommand(
|
||||
_config!.stopAppCommand, <String, String>{'appName': app!.name!});
|
||||
try {
|
||||
_logger.printStatus('Stop ${app.name!} for custom device.');
|
||||
await _processUtils.run(interpolated,
|
||||
throwOnError: true, timeout: const Duration(seconds: 10));
|
||||
_logger.printStatus('Stop Success.');
|
||||
} on ProcessException catch (e) {
|
||||
_logger.printError(
|
||||
'Error executing Stop app command for custom device $id: $e');
|
||||
}
|
||||
}
|
||||
|
||||
bool succeeded = true;
|
||||
// Walk a copy of _runningProcesses, since the exit handler removes from the
|
||||
// set.
|
||||
|
||||
Reference in New Issue
Block a user