Skip to content

Instantly share code, notes, and snippets.

@kenzieschmoll
Last active December 20, 2022 22:42
Show Gist options
  • Save kenzieschmoll/e77d6c630d884da4584b030fcfb75cf8 to your computer and use it in GitHub Desktop.
Save kenzieschmoll/e77d6c630d884da4584b030fcfb75cf8 to your computer and use it in GitHub Desktop.
flutter_tester process not shutting down
import 'dart:async';
import 'dart:io';
Future<void> main() async {
final testApp = TestFlutterApp(
// For reproducing, this should be the path to a flutter app, relative to the directory
// that this main.dart script lives in.
'develop/devtools/packages/devtools_app/test/test_infra/fixtures/flutter_app',
);
await testApp.startProcess();
}
class TestFlutterApp {
TestFlutterApp(this.appPath);
final String appPath;
Future<void> startProcess() async {
final runProcess = await Process.start(
'flutter',
[
'run',
'--machine',
'-d',
'flutter-tester',
],
workingDirectory: appPath,
);
final processId = runProcess.pid;
print('waiting 20 sec for app to spin up');
await Future.delayed(const Duration(seconds: 30));
print('killing');
// Tried both of these ways to kill the process.
Process.killPid(processId, ProcessSignal.sigkill);
// runProcess.kill(ProcessSignal.sigkill);
print('after killing, waiting 10 sec');
await Future.delayed(const Duration(seconds: 10));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment