Unnecessary new (#20138)
* enable lint unnecessary_new * fix tests * fix tests * fix tests
This commit is contained in:
committed by
GitHub
parent
d7a0dcaa4a
commit
d927c93310
@@ -13,7 +13,7 @@ import 'package:path/path.dart' as path;
|
||||
import 'utils.dart';
|
||||
|
||||
/// The root of the API for controlling devices.
|
||||
DeviceDiscovery get devices => new DeviceDiscovery();
|
||||
DeviceDiscovery get devices => DeviceDiscovery();
|
||||
|
||||
/// Device operating system the test is configured to test.
|
||||
enum DeviceOperatingSystem { android, ios }
|
||||
@@ -26,11 +26,11 @@ abstract class DeviceDiscovery {
|
||||
factory DeviceDiscovery() {
|
||||
switch (deviceOperatingSystem) {
|
||||
case DeviceOperatingSystem.android:
|
||||
return new AndroidDeviceDiscovery();
|
||||
return AndroidDeviceDiscovery();
|
||||
case DeviceOperatingSystem.ios:
|
||||
return new IosDeviceDiscovery();
|
||||
return IosDeviceDiscovery();
|
||||
default:
|
||||
throw new StateError('Unsupported device operating system: {config.deviceOperatingSystem}');
|
||||
throw StateError('Unsupported device operating system: {config.deviceOperatingSystem}');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,12 +103,12 @@ class AndroidDeviceDiscovery implements DeviceDiscovery {
|
||||
// Parses information about a device. Example:
|
||||
//
|
||||
// 015d172c98400a03 device usb:340787200X product:nakasi model:Nexus_7 device:grouper
|
||||
static final RegExp _kDeviceRegex = new RegExp(r'^(\S+)\s+(\S+)(.*)');
|
||||
static final RegExp _kDeviceRegex = RegExp(r'^(\S+)\s+(\S+)(.*)');
|
||||
|
||||
static AndroidDeviceDiscovery _instance;
|
||||
|
||||
factory AndroidDeviceDiscovery() {
|
||||
return _instance ??= new AndroidDeviceDiscovery._();
|
||||
return _instance ??= AndroidDeviceDiscovery._();
|
||||
}
|
||||
|
||||
AndroidDeviceDiscovery._();
|
||||
@@ -129,14 +129,14 @@ class AndroidDeviceDiscovery implements DeviceDiscovery {
|
||||
@override
|
||||
Future<Null> chooseWorkingDevice() async {
|
||||
final List<Device> allDevices = (await discoverDevices())
|
||||
.map((String id) => new AndroidDevice(deviceId: id))
|
||||
.map((String id) => AndroidDevice(deviceId: id))
|
||||
.toList();
|
||||
|
||||
if (allDevices.isEmpty)
|
||||
throw 'No Android devices detected';
|
||||
|
||||
// TODO(yjbanov): filter out and warn about those with low battery level
|
||||
_workingDevice = allDevices[new math.Random().nextInt(allDevices.length)];
|
||||
_workingDevice = allDevices[math.Random().nextInt(allDevices.length)];
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -174,13 +174,13 @@ class AndroidDeviceDiscovery implements DeviceDiscovery {
|
||||
final Map<String, HealthCheckResult> results = <String, HealthCheckResult>{};
|
||||
for (String deviceId in await discoverDevices()) {
|
||||
try {
|
||||
final AndroidDevice device = new AndroidDevice(deviceId: deviceId);
|
||||
final AndroidDevice device = AndroidDevice(deviceId: deviceId);
|
||||
// Just a smoke test that we can read wakefulness state
|
||||
// TODO(yjbanov): check battery level
|
||||
await device._getWakefulness();
|
||||
results['android-device-$deviceId'] = new HealthCheckResult.success();
|
||||
results['android-device-$deviceId'] = HealthCheckResult.success();
|
||||
} catch (e, s) {
|
||||
results['android-device-$deviceId'] = new HealthCheckResult.error(e, s);
|
||||
results['android-device-$deviceId'] = HealthCheckResult.error(e, s);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
@@ -278,7 +278,7 @@ class AndroidDevice implements Device {
|
||||
@override
|
||||
Future<Map<String, dynamic>> getMemoryStats(String packageName) async {
|
||||
final String meminfo = await shellEval('dumpsys', <String>['meminfo', packageName]);
|
||||
final Match match = new RegExp(r'TOTAL\s+(\d+)').firstMatch(meminfo);
|
||||
final Match match = RegExp(r'TOTAL\s+(\d+)').firstMatch(meminfo);
|
||||
assert(match != null, 'could not parse dumpsys meminfo output');
|
||||
return <String, dynamic>{
|
||||
'total_kb': int.parse(match.group(1)),
|
||||
@@ -287,13 +287,13 @@ class AndroidDevice implements Device {
|
||||
|
||||
@override
|
||||
Stream<String> get logcat {
|
||||
final Completer<void> stdoutDone = new Completer<void>();
|
||||
final Completer<void> stderrDone = new Completer<void>();
|
||||
final Completer<void> processDone = new Completer<void>();
|
||||
final Completer<void> abort = new Completer<void>();
|
||||
final Completer<void> stdoutDone = Completer<void>();
|
||||
final Completer<void> stderrDone = Completer<void>();
|
||||
final Completer<void> processDone = Completer<void>();
|
||||
final Completer<void> abort = Completer<void>();
|
||||
bool aborted = false;
|
||||
StreamController<String> stream;
|
||||
stream = new StreamController<String>(
|
||||
stream = StreamController<String>(
|
||||
onListen: () async {
|
||||
await adb(<String>['logcat', '--clear']);
|
||||
final Process process = await startProcess(adbPath, <String>['-s', deviceId, 'logcat']);
|
||||
@@ -353,7 +353,7 @@ class IosDeviceDiscovery implements DeviceDiscovery {
|
||||
static IosDeviceDiscovery _instance;
|
||||
|
||||
factory IosDeviceDiscovery() {
|
||||
return _instance ??= new IosDeviceDiscovery._();
|
||||
return _instance ??= IosDeviceDiscovery._();
|
||||
}
|
||||
|
||||
IosDeviceDiscovery._();
|
||||
@@ -374,14 +374,14 @@ class IosDeviceDiscovery implements DeviceDiscovery {
|
||||
@override
|
||||
Future<Null> chooseWorkingDevice() async {
|
||||
final List<IosDevice> allDevices = (await discoverDevices())
|
||||
.map((String id) => new IosDevice(deviceId: id))
|
||||
.map((String id) => IosDevice(deviceId: id))
|
||||
.toList();
|
||||
|
||||
if (allDevices.isEmpty)
|
||||
throw 'No iOS devices detected';
|
||||
|
||||
// TODO(yjbanov): filter out and warn about those with low battery level
|
||||
_workingDevice = allDevices[new math.Random().nextInt(allDevices.length)];
|
||||
_workingDevice = allDevices[math.Random().nextInt(allDevices.length)];
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -400,7 +400,7 @@ class IosDeviceDiscovery implements DeviceDiscovery {
|
||||
final Map<String, HealthCheckResult> results = <String, HealthCheckResult>{};
|
||||
for (String deviceId in await discoverDevices()) {
|
||||
// TODO(ianh): do a more meaningful connectivity check than just recording the ID
|
||||
results['ios-device-$deviceId'] = new HealthCheckResult.success();
|
||||
results['ios-device-$deviceId'] = HealthCheckResult.success();
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ bool _isTaskRegistered = false;
|
||||
/// registered per Dart VM.
|
||||
Future<TaskResult> task(TaskFunction task) {
|
||||
if (_isTaskRegistered)
|
||||
throw new StateError('A task is already registered');
|
||||
throw StateError('A task is already registered');
|
||||
|
||||
_isTaskRegistered = true;
|
||||
|
||||
@@ -43,13 +43,13 @@ Future<TaskResult> task(TaskFunction task) {
|
||||
print('${rec.level.name}: ${rec.time}: ${rec.message}');
|
||||
});
|
||||
|
||||
final _TaskRunner runner = new _TaskRunner(task);
|
||||
final _TaskRunner runner = _TaskRunner(task);
|
||||
runner.keepVmAliveUntilTaskRunRequested();
|
||||
return runner.whenDone;
|
||||
}
|
||||
|
||||
class _TaskRunner {
|
||||
static final Logger logger = new Logger('TaskRunner');
|
||||
static final Logger logger = Logger('TaskRunner');
|
||||
|
||||
final TaskFunction task;
|
||||
|
||||
@@ -58,20 +58,20 @@ class _TaskRunner {
|
||||
Timer _startTaskTimeout;
|
||||
bool _taskStarted = false;
|
||||
|
||||
final Completer<TaskResult> _completer = new Completer<TaskResult>();
|
||||
final Completer<TaskResult> _completer = Completer<TaskResult>();
|
||||
|
||||
_TaskRunner(this.task) {
|
||||
registerExtension('ext.cocoonRunTask',
|
||||
(String method, Map<String, String> parameters) async {
|
||||
final Duration taskTimeout = parameters.containsKey('timeoutInMinutes')
|
||||
? new Duration(minutes: int.parse(parameters['timeoutInMinutes']))
|
||||
? Duration(minutes: int.parse(parameters['timeoutInMinutes']))
|
||||
: _kDefaultTaskTimeout;
|
||||
final TaskResult result = await run(taskTimeout);
|
||||
return new ServiceExtensionResponse.result(json.encode(result.toJson()));
|
||||
return ServiceExtensionResponse.result(json.encode(result.toJson()));
|
||||
});
|
||||
registerExtension('ext.cocoonRunnerReady',
|
||||
(String method, Map<String, String> parameters) async {
|
||||
return new ServiceExtensionResponse.result('"ready"');
|
||||
return ServiceExtensionResponse.result('"ready"');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ class _TaskRunner {
|
||||
return result;
|
||||
} on TimeoutException catch (_) {
|
||||
print('Task timed out in framework.dart after $taskTimeout.');
|
||||
return new TaskResult.failure('Task timed out after $taskTimeout');
|
||||
return TaskResult.failure('Task timed out after $taskTimeout');
|
||||
} finally {
|
||||
print('Cleaning up after task...');
|
||||
await forceQuitRunningProcesses();
|
||||
@@ -99,15 +99,15 @@ class _TaskRunner {
|
||||
/// received via the VM service protocol.
|
||||
void keepVmAliveUntilTaskRunRequested() {
|
||||
if (_taskStarted)
|
||||
throw new StateError('Task already started.');
|
||||
throw StateError('Task already started.');
|
||||
|
||||
// Merely creating this port object will cause the VM to stay alive and keep
|
||||
// the VM service server running until the port is disposed of.
|
||||
_keepAlivePort = new RawReceivePort();
|
||||
_keepAlivePort = RawReceivePort();
|
||||
|
||||
// Timeout if nothing bothers to connect and ask us to run the task.
|
||||
const Duration taskStartTimeout = Duration(seconds: 60);
|
||||
_startTaskTimeout = new Timer(taskStartTimeout, () {
|
||||
_startTaskTimeout = Timer(taskStartTimeout, () {
|
||||
if (!_taskStarted) {
|
||||
logger.severe('Task did not start in $taskStartTimeout.');
|
||||
_closeKeepAlivePort();
|
||||
@@ -123,7 +123,7 @@ class _TaskRunner {
|
||||
}
|
||||
|
||||
Future<TaskResult> _performTask() {
|
||||
final Completer<TaskResult> completer = new Completer<TaskResult>();
|
||||
final Completer<TaskResult> completer = Completer<TaskResult>();
|
||||
Chain.capture(() async {
|
||||
completer.complete(await task());
|
||||
}, onError: (dynamic taskError, Chain taskErrorStack) {
|
||||
@@ -138,7 +138,7 @@ class _TaskRunner {
|
||||
// code. Our goal is to convert the failure into a readable message.
|
||||
// Propagating it further is not useful.
|
||||
if (!completer.isCompleted)
|
||||
completer.complete(new TaskResult.failure(message));
|
||||
completer.complete(TaskResult.failure(message));
|
||||
});
|
||||
return completer.future;
|
||||
}
|
||||
@@ -167,7 +167,7 @@ class TaskResult {
|
||||
/// Constructs a successful result using JSON data stored in a file.
|
||||
factory TaskResult.successFromFile(File file,
|
||||
{List<String> benchmarkScoreKeys}) {
|
||||
return new TaskResult.success(json.decode(file.readAsStringSync()),
|
||||
return TaskResult.success(json.decode(file.readAsStringSync()),
|
||||
benchmarkScoreKeys: benchmarkScoreKeys);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class ManifestError extends Error {
|
||||
// manually. It's not too much code and produces good error messages.
|
||||
Manifest _validateAndParseManifest(Map<dynamic, dynamic> manifestYaml) {
|
||||
_checkKeys(manifestYaml, 'manifest', const <String>['tasks']);
|
||||
return new Manifest._(_validateAndParseTasks(manifestYaml['tasks']));
|
||||
return Manifest._(_validateAndParseTasks(manifestYaml['tasks']));
|
||||
}
|
||||
|
||||
List<ManifestTask> _validateAndParseTasks(dynamic tasksYaml) {
|
||||
@@ -108,7 +108,7 @@ ManifestTask _validateAndParseTask(dynamic taskName, dynamic taskYaml) {
|
||||
}
|
||||
|
||||
final List<dynamic> capabilities = _validateAndParseCapabilities(taskName, taskYaml['required_agent_capabilities']);
|
||||
return new ManifestTask._(
|
||||
return ManifestTask._(
|
||||
name: taskName,
|
||||
description: taskYaml['description'],
|
||||
stage: taskYaml['stage'],
|
||||
@@ -129,7 +129,7 @@ List<String> _validateAndParseCapabilities(String taskName, dynamic capabilities
|
||||
|
||||
void _checkType(bool isValid, dynamic value, String variableName, String typeName) {
|
||||
if (!isValid) {
|
||||
throw new ManifestError(
|
||||
throw ManifestError(
|
||||
'$variableName must be a $typeName but was ${value.runtimeType}: $value',
|
||||
);
|
||||
}
|
||||
@@ -137,14 +137,14 @@ void _checkType(bool isValid, dynamic value, String variableName, String typeNam
|
||||
|
||||
void _checkIsNotBlank(dynamic value, String variableName, String ownerName) {
|
||||
if (value == null || value.isEmpty) {
|
||||
throw new ManifestError('$variableName must not be empty in $ownerName.');
|
||||
throw ManifestError('$variableName must not be empty in $ownerName.');
|
||||
}
|
||||
}
|
||||
|
||||
void _checkKeys(Map<dynamic, dynamic> map, String variableName, List<String> allowedKeys) {
|
||||
for (String key in map.keys) {
|
||||
if (!allowedKeys.contains(key)) {
|
||||
throw new ManifestError(
|
||||
throw ManifestError(
|
||||
'Unrecognized property "$key" in $variableName. '
|
||||
'Allowed properties: ${allowedKeys.join(', ')}');
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent = false }) a
|
||||
runnerFinished = true;
|
||||
});
|
||||
|
||||
final Completer<int> port = new Completer<int>();
|
||||
final Completer<int> port = Completer<int>();
|
||||
|
||||
final StreamSubscription<String> stdoutSub = runner.stdout
|
||||
.transform(const Utf8Decoder())
|
||||
@@ -90,14 +90,14 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent = false }) a
|
||||
|
||||
Future<VMIsolateRef> _connectToRunnerIsolate(int vmServicePort) async {
|
||||
final String url = 'ws://localhost:$vmServicePort/ws';
|
||||
final DateTime started = new DateTime.now();
|
||||
final DateTime started = DateTime.now();
|
||||
|
||||
// TODO(yjbanov): due to lack of imagination at the moment the handshake with
|
||||
// the task process is very rudimentary and requires this small
|
||||
// delay to let the task process open up the VM service port.
|
||||
// Otherwise we almost always hit the non-ready case first and
|
||||
// wait a whole 1 second, which is annoying.
|
||||
await new Future<Null>.delayed(const Duration(milliseconds: 100));
|
||||
await Future<Null>.delayed(const Duration(milliseconds: 100));
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
@@ -105,7 +105,7 @@ Future<VMIsolateRef> _connectToRunnerIsolate(int vmServicePort) async {
|
||||
await (await WebSocket.connect(url)).close();
|
||||
|
||||
// Look up the isolate.
|
||||
final VMServiceClient client = new VMServiceClient.connect(url);
|
||||
final VMServiceClient client = VMServiceClient.connect(url);
|
||||
final VM vm = await client.getVM();
|
||||
final VMIsolateRef isolate = vm.isolates.single;
|
||||
final String response = await isolate.invokeExtension('ext.cocoonRunnerReady');
|
||||
@@ -114,8 +114,8 @@ Future<VMIsolateRef> _connectToRunnerIsolate(int vmServicePort) async {
|
||||
return isolate;
|
||||
} catch (error) {
|
||||
const Duration connectionTimeout = Duration(seconds: 10);
|
||||
if (new DateTime.now().difference(started) > connectionTimeout) {
|
||||
throw new TimeoutException(
|
||||
if (DateTime.now().difference(started) > connectionTimeout) {
|
||||
throw TimeoutException(
|
||||
'Failed to connect to the task runner process',
|
||||
connectionTimeout,
|
||||
);
|
||||
@@ -123,7 +123,7 @@ Future<VMIsolateRef> _connectToRunnerIsolate(int vmServicePort) async {
|
||||
print('VM service not ready yet: $error');
|
||||
const Duration pauseBetweenRetries = Duration(milliseconds: 200);
|
||||
print('Will retry in $pauseBetweenRetries.');
|
||||
await new Future<Null>.delayed(pauseBetweenRetries);
|
||||
await Future<Null>.delayed(pauseBetweenRetries);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,8 +142,8 @@ Future<void> cleanupSystem() async {
|
||||
print('\nTelling Gradle to shut down (JAVA_HOME=$javaHome)');
|
||||
final String gradlewBinaryName = Platform.isWindows ? 'gradlew.bat' : 'gradlew';
|
||||
final Directory tempDir = Directory.systemTemp.createTempSync('flutter_devicelab_shutdown_gradle.');
|
||||
recursiveCopy(new Directory(path.join(flutterDirectory.path, 'bin', 'cache', 'artifacts', 'gradle_wrapper')), tempDir);
|
||||
copy(new File(path.join(path.join(flutterDirectory.path, 'packages', 'flutter_tools'), 'templates', 'create', 'android.tmpl', 'gradle', 'wrapper', 'gradle-wrapper.properties')), new Directory(path.join(tempDir.path, 'gradle', 'wrapper')));
|
||||
recursiveCopy(Directory(path.join(flutterDirectory.path, 'bin', 'cache', 'artifacts', 'gradle_wrapper')), tempDir);
|
||||
copy(File(path.join(path.join(flutterDirectory.path, 'packages', 'flutter_tools'), 'templates', 'create', 'android.tmpl', 'gradle', 'wrapper', 'gradle-wrapper.properties')), Directory(path.join(tempDir.path, 'gradle', 'wrapper')));
|
||||
if (!Platform.isWindows) {
|
||||
await exec(
|
||||
'chmod',
|
||||
|
||||
@@ -24,7 +24,7 @@ ProcessManager _processManager = const LocalProcessManager();
|
||||
class ProcessInfo {
|
||||
ProcessInfo(this.command, this.process);
|
||||
|
||||
final DateTime startTime = new DateTime.now();
|
||||
final DateTime startTime = DateTime.now();
|
||||
final String command;
|
||||
final Process process;
|
||||
|
||||
@@ -52,7 +52,7 @@ class HealthCheckResult {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
final StringBuffer buf = new StringBuffer(succeeded ? 'succeeded' : 'failed');
|
||||
final StringBuffer buf = StringBuffer(succeeded ? 'succeeded' : 'failed');
|
||||
if (details != null && details.trim().isNotEmpty) {
|
||||
buf.writeln();
|
||||
// Indent details by 4 spaces
|
||||
@@ -74,7 +74,7 @@ class BuildFailedError extends Error {
|
||||
}
|
||||
|
||||
void fail(String message) {
|
||||
throw new BuildFailedError(message);
|
||||
throw BuildFailedError(message);
|
||||
}
|
||||
|
||||
// Remove the given file or directory.
|
||||
@@ -98,9 +98,9 @@ void rmTree(FileSystemEntity entity) {
|
||||
|
||||
List<FileSystemEntity> ls(Directory directory) => directory.listSync();
|
||||
|
||||
Directory dir(String path) => new Directory(path);
|
||||
Directory dir(String path) => Directory(path);
|
||||
|
||||
File file(String path) => new File(path);
|
||||
File file(String path) => File(path);
|
||||
|
||||
void copy(File sourceFile, Directory targetDirectory, {String name}) {
|
||||
final File target = file(
|
||||
@@ -115,9 +115,9 @@ void recursiveCopy(Directory source, Directory target) {
|
||||
for (FileSystemEntity entity in source.listSync(followLinks: false)) {
|
||||
final String name = path.basename(entity.path);
|
||||
if (entity is Directory)
|
||||
recursiveCopy(entity, new Directory(path.join(target.path, name)));
|
||||
recursiveCopy(entity, Directory(path.join(target.path, name)));
|
||||
else if (entity is File) {
|
||||
final File dest = new File(path.join(target.path, name));
|
||||
final File dest = File(path.join(target.path, name));
|
||||
dest.writeAsBytesSync(entity.readAsBytesSync());
|
||||
}
|
||||
}
|
||||
@@ -187,7 +187,7 @@ Future<DateTime> getFlutterRepoCommitTimestamp(String commit) {
|
||||
commit,
|
||||
]);
|
||||
final int secondsSinceEpoch = int.parse(unixTimestamp);
|
||||
return new DateTime.fromMillisecondsSinceEpoch(secondsSinceEpoch * 1000);
|
||||
return DateTime.fromMillisecondsSinceEpoch(secondsSinceEpoch * 1000);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ Future<Process> startProcess(
|
||||
environment: environment,
|
||||
workingDirectory: workingDirectory ?? cwd,
|
||||
);
|
||||
final ProcessInfo processInfo = new ProcessInfo(command, process);
|
||||
final ProcessInfo processInfo = ProcessInfo(command, process);
|
||||
_runningProcesses.add(processInfo);
|
||||
|
||||
process.exitCode.then((int exitCode) {
|
||||
@@ -248,7 +248,7 @@ Future<Null> forceQuitRunningProcesses() async {
|
||||
return;
|
||||
|
||||
// Give normally quitting processes a chance to report their exit code.
|
||||
await new Future<Null>.delayed(const Duration(seconds: 1));
|
||||
await Future<Null>.delayed(const Duration(seconds: 1));
|
||||
|
||||
// Whatever's left, kill it.
|
||||
for (ProcessInfo p in _runningProcesses) {
|
||||
@@ -270,8 +270,8 @@ Future<int> exec(
|
||||
}) async {
|
||||
final Process process = await startProcess(executable, arguments, environment: environment, workingDirectory: workingDirectory);
|
||||
|
||||
final Completer<Null> stdoutDone = new Completer<Null>();
|
||||
final Completer<Null> stderrDone = new Completer<Null>();
|
||||
final Completer<Null> stdoutDone = Completer<Null>();
|
||||
final Completer<Null> stderrDone = Completer<Null>();
|
||||
process.stdout
|
||||
.transform(utf8.decoder)
|
||||
.transform(const LineSplitter())
|
||||
@@ -306,9 +306,9 @@ Future<String> eval(
|
||||
}) async {
|
||||
final Process process = await startProcess(executable, arguments, environment: environment, workingDirectory: workingDirectory);
|
||||
|
||||
final StringBuffer output = new StringBuffer();
|
||||
final Completer<Null> stdoutDone = new Completer<Null>();
|
||||
final Completer<Null> stderrDone = new Completer<Null>();
|
||||
final StringBuffer output = StringBuffer();
|
||||
final Completer<Null> stdoutDone = Completer<Null>();
|
||||
final Completer<Null> stderrDone = Completer<Null>();
|
||||
process.stdout
|
||||
.transform(utf8.decoder)
|
||||
.transform(const LineSplitter())
|
||||
@@ -496,7 +496,7 @@ Iterable<String> grep(Pattern pattern, {@required String from}) {
|
||||
///
|
||||
/// }
|
||||
Future<Null> runAndCaptureAsyncStacks(Future<Null> callback()) {
|
||||
final Completer<Null> completer = new Completer<Null>();
|
||||
final Completer<Null> completer = Completer<Null>();
|
||||
Chain.capture(() async {
|
||||
await callback();
|
||||
completer.complete();
|
||||
@@ -507,7 +507,7 @@ Future<Null> runAndCaptureAsyncStacks(Future<Null> callback()) {
|
||||
bool canRun(String path) => _processManager.canRun(path);
|
||||
|
||||
String extractCloudAuthTokenArg(List<String> rawArgs) {
|
||||
final ArgParser argParser = new ArgParser()..addOption('cloud-auth-token');
|
||||
final ArgParser argParser = ArgParser()..addOption('cloud-auth-token');
|
||||
ArgResults args;
|
||||
try {
|
||||
args = argParser.parse(rawArgs);
|
||||
@@ -536,7 +536,7 @@ int parseServicePort(String line, {
|
||||
bool multiLine = false,
|
||||
}) {
|
||||
// e.g. "An Observatory debugger and profiler on ... is available at: http://127.0.0.1:8100/"
|
||||
final RegExp pattern = new RegExp('$prefix(\\S+:(\\d+)/\\S*)\$', multiLine: multiLine);
|
||||
final RegExp pattern = RegExp('$prefix(\\S+:(\\d+)/\\S*)\$', multiLine: multiLine);
|
||||
final Match match = pattern.firstMatch(line);
|
||||
return match == null ? null : int.parse(match.group(2));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user