VeryGoodOpenSource / very_good_cli

A Very Good Command-Line Interface for Dart created by Very Good Ventures 🦄
http://cli.vgv.dev
MIT License
2.14k stars 186 forks source link

.test_optimizer.dart cleanup is skipped on SIGINT #1053

Open ishchhabra opened 2 months ago

ishchhabra commented 2 months ago

Description

When a long-running test suite is terminated using CMD + C, .test_optimizer.dart is not cleaned up, and the file persists.

Steps To Reproduce

  1. Create a new Flutter application with very_good create flutter_app <project_name>
  2. Modify app_test.dart and add the following code to simulate a long-running test:
    await tester.runAsync(() async {
    await Future<void>.delayed(const Duration(seconds: 60));
    });
  3. Run the test suite using very_good test
  4. Terminate the test suite before it finishes using CMD + C.
  5. .test_optimizer.dart is not deleted automatically.

Expected Behavior

.test_optimizer.dart should be cleaned up automatically and should not persist.

Additional Context

It seems like the CLI is not catching the SIGINT signal. Implementing signal handling could help perform cleanup before termination of the application:

import 'dart:io';

void main() {
  ProcessSignal.sigint.watch().listen((signal) {
    // Perform cleanup...
  });
}
alestiago commented 1 month ago

@ishchhabra thanks for opening the issue! This issue has been labelled with a P2, which means it is an important issue but not at the top of the work list. Is it blocking you? Are you interested in contributing and solving it? If so, if you submit a PR the team might be able to help you through it and landing it!