forked from mmcc007/tool_base
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcontext_runner.dart
More file actions
28 lines (25 loc) · 886 Bytes
/
Copy pathcontext_runner.dart
File metadata and controls
28 lines (25 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:process/process.dart';
import 'package:tool_base/tool_base.dart';
Future<T> runInContext<T>(
FutureOr<T> runner(), {
Map<Type, Generator> overrides,
}) async {
return await context.run<T>(
name: 'global fallbacks',
body: runner,
overrides: overrides,
fallbacks: <Type, Generator>{
BotDetector: () => const BotDetector(),
Config: () => Config(),
Logger: () => platform.isWindows ? WindowsStdoutLogger() : StdoutLogger(),
OperatingSystemUtils: () => OperatingSystemUtils(),
ProcessManager: () => LocalProcessManager(),
Stdio: () => const Stdio(),
TimeoutConfiguration: () => const TimeoutConfiguration(),
},
);
}