Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: packages/which/lib/src/which_impl.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « packages/which/lib/src/util.dart ('k') | packages/which/lib/which.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1
2 library which.src.which_impl;
3
4 import 'dart:async';
5
6 import 'package:when/when.dart';
7
8 import 'util.dart';
9
10 Future<String> which(
11 String command,
12 Iterable<String> candidatePaths,
13 bool isWindows,
14 Future<bool> isExecutable(String path, bool isWindows),
15 orElse()) => new Future(() => _which(
16 command,
17 candidatePaths,
18 isWindows,
19 isExecutable,
20 orElse,
21 toSequence: (items) => new Stream.fromIterable(items)));
22
23 String whichSync(
24 String command,
25 Iterable<String> candidatePaths,
26 bool isWindows,
27 bool isExecutable(String path, bool isWindows),
28 orElse()) => _which(
29 command,
30 candidatePaths,
31 isWindows,
32 isExecutable,
33 orElse);
34
35 _which(
36 String command,
37 Iterable<String> candidatePaths,
38 bool isWindows,
39 isExecutable(String path, bool isWindows),
40 orElse(),
41 {toSequence(Iterable items): identity}) => when(
42 () => firstWhere(
43 toSequence(candidatePaths),
44 (path) => isExecutable(path, isWindows),
45 orElse: orElse != null ? orElse : () => _commandNotFound(command, null)) ,
46 onError: (e) => _commandNotFound(command, e));
47
48 _commandNotFound(String command, e) {
49 var message = 'Command not found: $command';
50 if (e != null) message += '\n$e';
51 throw new StateError(message);
52 }
OLDNEW
« no previous file with comments | « packages/which/lib/src/util.dart ('k') | packages/which/lib/which.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698