Run pub with --trace (#12328)
See https://github.com/dart-lang/pub/issues/1714
This commit is contained in:
parent
21899ce62f
commit
89566feeed
@ -81,12 +81,18 @@ typedef String MessageFilter(String message);
|
|||||||
/// Runs pub in 'batch' mode, forwarding complete lines written by pub to its
|
/// Runs pub in 'batch' mode, forwarding complete lines written by pub to its
|
||||||
/// stdout/stderr streams to the corresponding stream of this process, optionally
|
/// stdout/stderr streams to the corresponding stream of this process, optionally
|
||||||
/// applying filtering. The pub process will not receive anything on its stdin stream.
|
/// applying filtering. The pub process will not receive anything on its stdin stream.
|
||||||
|
///
|
||||||
|
/// The `--trace` argument is passed to `pub` (by mutating the provided
|
||||||
|
/// `arguments` list) unless `showTraceForErrors` is false.
|
||||||
Future<Null> pub(List<String> arguments, {
|
Future<Null> pub(List<String> arguments, {
|
||||||
String directory,
|
String directory,
|
||||||
MessageFilter filter,
|
MessageFilter filter,
|
||||||
String failureMessage: 'pub failed',
|
String failureMessage: 'pub failed',
|
||||||
@required bool retry,
|
@required bool retry,
|
||||||
|
bool showTraceForErrors: true,
|
||||||
}) async {
|
}) async {
|
||||||
|
if (showTraceForErrors)
|
||||||
|
arguments.insert(0, '--trace');
|
||||||
int attempts = 0;
|
int attempts = 0;
|
||||||
int duration = 1;
|
int duration = 1;
|
||||||
int code;
|
int code;
|
||||||
|
@ -82,10 +82,11 @@ void main() {
|
|||||||
testUsingContext('test', () async {
|
testUsingContext('test', () async {
|
||||||
await createTestCommandRunner(new PackagesCommand()).run(<String>['packages', 'test']);
|
await createTestCommandRunner(new PackagesCommand()).run(<String>['packages', 'test']);
|
||||||
final List<String> commands = mockProcessManager.commands;
|
final List<String> commands = mockProcessManager.commands;
|
||||||
expect(commands, hasLength(3));
|
expect(commands, hasLength(4));
|
||||||
expect(commands[0], matches(r'dart-sdk[\\/]bin[\\/]pub'));
|
expect(commands[0], matches(r'dart-sdk[\\/]bin[\\/]pub'));
|
||||||
expect(commands[1], 'run');
|
expect(commands[1], '--trace');
|
||||||
expect(commands[2], 'test');
|
expect(commands[2], 'run');
|
||||||
|
expect(commands[3], 'test');
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => mockProcessManager,
|
ProcessManager: () => mockProcessManager,
|
||||||
Stdio: () => mockStdio,
|
Stdio: () => mockStdio,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user