detectByCommand method

Future<bool> detectByCommand(
  1. String command
)

Detect if agent is installed on system using command

Implementation

Future<bool> detectByCommand(String command) async {
  try {
    final result = await Process.run(
      Platform.isWindows ? 'cmd' : 'sh',
      Platform.isWindows ? ['/c', command] : ['-c', command],
      runInShell: true,
    );

    return result.exitCode == 0;
  } catch (e) {
    return false;
  }
}