mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
27 lines
838 B
Dart
27 lines
838 B
Dart
// Copyright 2015 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.
|
|
|
|
library sky_tools.process_wrapper;
|
|
|
|
import 'dart:io';
|
|
import 'package:logging/logging.dart';
|
|
|
|
final Logger _logging = new Logger('sky_tools.process_wrapper');
|
|
String runCheckedSync(List<String> cmd) {
|
|
_logging.info(cmd.join(' '));
|
|
ProcessResult results =
|
|
Process.runSync(cmd[0], cmd.getRange(1, cmd.length).toList());
|
|
if (results.exitCode != 0) {
|
|
if (results.stderr.length > 0) {
|
|
_logging.info('Errors logged: ' + results.stderr);
|
|
}
|
|
throw 'Error code ' +
|
|
results.exitCode.toString() +
|
|
' returned when attempting to run command: ' +
|
|
cmd.join(' ');
|
|
}
|
|
_logging.fine(results.stdout.trim());
|
|
return results.stdout;
|
|
}
|