bool isProcessAlive(int pid) { try { final result = Process.runSync('kill', ['-0', pid.toString()]); return result.exitCode == 0; } catch (_) { return false; } }