Skip to content

Can't exit flutter tests when running it via dart process #98395

Closed

Description

@cedvdb

Repro:

https://github.com/cedvdb/flutter_repros/tree/drive_ctrl_c

  • get the correct branch
  • run emulator
  • dart run run_me.dart

You now can't exit the test using ctrl + c.

result

image

That is when run via with inheritStdio.

Here is a gif with detachedStdio which opens several terminals and thereafter runs the tests which is cancellable via ctrl + c. I mention this in case the several terminal openings is related to why it does not work with inheritStdio. Also because I don't think it should open those terminals.

Recording 2022-02-14 at 14 45 15

env

I'm on windows 11, running that command from git bash.

Doctor summary

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.1, on Microsoft Windows [Version 10.0.22000.493], locale en-BE)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.10)
[✓] Android Studio (version 4.0)
[✓] VS Code, 64-bit edition (version 1.64.1)
[✓] Connected device (4 available)
[✓] HTTP Host Availability

Activity

  1. maheshj01 commented on Feb 14, 2022

    @maheshj01
    Member

    Hi @cedvdb, thanks for filing the issue I followed your reproducible steps and I was able to exit the tests, However, I had to press enter twice on entering "y" could you confirm if this is the same case for you? or process doesn't exit at all even after pressing enter multiple times?

    image

    logs
    PS C:\Users\mahesh\Desktop\flutter_repros> dart run run_me.dart
    Running "flutter pub get" in flutter_repros...                     641ms
    Multiple devices found:
    Redmi K20 Pro (mobile)       • 192.168.1.2:5555 • android-arm64  • Android 11 (API 30)
    sdk gphone64 x86 64 (mobile) • emulator-5554    • android-x64    • Android 12 (API 31) (emulator)
    Windows (desktop)            • windows          • windows-x64    • Microsoft Windows [Version    
    10.0.19044.1466]
    Chrome (web)                 • chrome           • web-javascript • Google Chrome 98.0.4758.82    
    Edge (web)                   • edge             • web-javascript • Microsoft Edge 97.0.1072.76   
    [1]: Redmi K20 Pro (192.168.1.2:5555)
    [2]: sdk gphone64 x86 64 (emulator-5554)
    [3]: Windows (windows)
    [4]: Chrome (chrome)
    [5]: Edge (edge)
    Please choose one (To quit, press "q/Q"): 1
    Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
    Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
    Running Gradle task 'assembleDebug'...                             32.3s
    √  Built build\app\outputs\flutter-apk\app-debug.apk.
    Installing build\app\outputs\flutter-apk\app.apk...                19.0s
    Error: ADB exited with exit code 1
    Performing Streamed Install
    
    adb: failed to install
    C:\Users\mahesh\Desktop\flutter_repros\build\app\outputs\flutter-apk\app.apk: Failure
    [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.example.flutter_repros signatures do not match    
    previously installed version; ignoring!]
    Uninstalling old version...
    Installing build\app\outputs\flutter-apk\app.apk...                21.9s
    Error: ADB exited with exit code 1
    Performing Streamed Install
    
    adb: failed to install
    C:\Users\mahesh\Desktop\flutter_repros\build\app\outputs\flutter-apk\app.apk: Failure
    [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]
    PS C:\Users\mahesh\Desktop\flutter_repros> dart run run_me.dart
    Running "flutter pub get" in flutter_repros...                     732ms
    Multiple devices found:
    Redmi K20 Pro (mobile)       • 192.168.1.2:5555 • android-arm64  • Android 11 (API 30)
    sdk gphone64 x86 64 (mobile) • emulator-5554    • android-x64    • Android 12 (API 31) (emulator)
    Windows (desktop)            • windows          • windows-x64    • Microsoft Windows [Version    
    10.0.19044.1466]
    Chrome (web)                 • chrome           • web-javascript • Google Chrome 98.0.4758.82    
    Edge (web)                   • edge             • web-javascript • Microsoft Edge 97.0.1072.76   
    [1]: Redmi K20 Pro (192.168.1.2:5555)
    [2]: sdk gphone64 x86 64 (emulator-5554)
    [3]: Windows (windows)
    [4]: Chrome (chrome)
    [5]: Edge (edge)
    Please choose one (To quit, press "q/Q"): 1
    Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
    Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
    Running Gradle task 'assembleDebug'...                             15.7s
    √  Built build\app\outputs\flutter-apk\app-debug.apk.
    Installing build\app\outputs\flutter-apk\app.apk...                16.0s
    Error: ADB exited with exit code 1
    Performing Streamed Install
    
    adb: failed to install
    C:\Users\mahesh\Desktop\flutter_repros\build\app\outputs\flutter-apk\app.apk: Failure
    [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.example.flutter_repros signatures do not match    
    previously installed version; ignoring!]
    Uninstalling old version...
    Installing build\app\outputs\flutter-apk\app.apk...                20.5s
    VMServiceFlutterDriver: Connecting to Flutter application at http://127.0.0.1:63554/2bxuxiertnk=/
    VMServiceFlutterDriver: Isolate found with number: 923730394982763
    VMServiceFlutterDriver: Isolate is paused at start.
    VMServiceFlutterDriver: Attempting to resume isolate
    I/flutter (30698): 00:00 +0: end-to-end test tap on the floating action button, verify counter
    VMServiceFlutterDriver: Connected to Flutter application.
    I/.flutter_repro(30698): ProcessProfilingInfo new_methods=964 is saved saved_to_disk=1
    resolve_classes_delay=8000
    ^CTerminate batch job (Y/N)? Terminate batch job (Y/N)? y
    
    Terminate batch job (Y/N)? 
    PS C:\Users\mahesh\Desktop\flutter_repros> 
    
    flutter doctor -v
    [√] Flutter (Channel stable, 2.10.1, on Microsoft Windows [Version 10.0.19044.1466], locale en-US)
        • Flutter version 2.10.1 at C:\flutter_sdk\stable
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision db747aa133 (5 days ago), 2022-02-09 13:57:35 -0600
        • Engine revision ab46186b24
        • Dart version 2.16.1
        • DevTools version 2.9.2
    
    [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at C:\Users\mahesh\AppData\Local\Android\sdk
        • Platform android-31, build-tools 31.0.0
        • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web
        • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.4)
        • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
        • Visual Studio Community 2019 version 16.11.31727.386
        • Windows 10 SDK version 10.0.19041.0
    
    [√] Android Studio (version 2020.3)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    
    [√] VS Code (version 1.63.2)
        • VS Code at C:\Users\mahesh\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.34.0
    
    [√] Connected device (5 available)
        • Redmi K20 Pro (mobile)       • 192.168.1.2:5555 • android-arm64  • Android 11 (API 30)
        • sdk gphone64 x86 64 (mobile) • emulator-5554    • android-x64    • Android 12 (API 31) (emulator)
        • Windows (desktop)            • windows          • windows-x64    • Microsoft Windows [Version 10.0.19044.1466]
        • Chrome (web)                 • chrome           • web-javascript • Google Chrome 98.0.4758.82
        • Edge (web)                   • edge             • web-javascript • Microsoft Edge 97.0.1072.76
    
    [√] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
    
  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Feb 14, 2022
  3. cedvdb commented on Feb 14, 2022

    @cedvdb
    ContributorAuthor

    Apperently it exits when pressing Y twice on my end too. However this is just a small reproduction of an issue I'm having. In the real scenario I cannot get out of the terminal at all. Since this small repro exhibits some odd behavior, my guess is that solving those oddities will also solve the issues I have in the real project.

    The two oddities are:

    • when the process is launched with ProcessStartMode.inheritStdio , you have to press Y twice to get out of the process.
    • when the process is launched with ProcessStartMode.detached, multiple terminals are open.

    Those may, or may not stem from the same issue, but I've a feeling it is. If you change in my repro ProcessStartMode.inheritStdio to ProcessStartMode.detached you will see multiple terminals opening as I have posted in the gif above.

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Feb 14, 2022
  5. maheshj01 commented on Feb 15, 2022

    @maheshj01
    Member

    However this is just a small reproduction of an issue I'm having. In the real scenario I cannot get out of the terminal at all. Since this small repro exhibits some odd behavior, my guess is that solving those oddities will also solve the issues I have in the real project.

    Thanks for the info @cedvdb, This is the output I get when running in ProcessStartMode.inheritStdio I have to submit y twice to exit the dart process.

    run_me.dart.-.flutter_repros.-.Visual.Studio.Code.2022-02-15.12-20-14_Trim.mp4

    And Incase of ProcessStartMode.detached, I see several command prompts launching and getting killed and then there's one cmd where the tests start running and on pressing ctrl +c the window closes

    2022-02-15.12-34-12_Trim.mp4
    flutter doctor -v
    [√] Flutter (Channel stable, 2.10.1, on Microsoft Windows [Version 10.0.19044.1466], locale        
        en-US)
        • Flutter version 2.10.1 at C:\flutter_sdk\stable
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision db747aa133 (5 days ago), 2022-02-09 13:57:35 -0600
        • Engine revision ab46186b24
        • Dart version 2.16.1
        • DevTools version 2.9.2
    
    [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at C:\Users\mahesh\AppData\Local\Android\sdk
        • Platform android-31, build-tools 31.0.0
        • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java      
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)    
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web
        • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.4)
        • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
        • Visual Studio Community 2019 version 16.11.31727.386
        • Windows 10 SDK version 10.0.19041.0
    
    [√] Android Studio (version 2020.3)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    
    [√] VS Code (version 1.63.2)
        • VS Code at C:\Users\mahesh\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.34.0
    
    [√] Connected device (5 available)
        • Redmi K20 Pro (mobile)       • 192.168.1.2:5555 • android-arm64  • Android 11 (API 30)       
        • sdk gphone64 x86 64 (mobile) • emulator-5554    • android-x64    • Android 12 (API 31)       
          (emulator)
        • Windows (desktop)            • windows          • windows-x64    • Microsoft Windows [Version      10.0.19044.1466]
        • Chrome (web)                 • chrome           • web-javascript • Google Chrome 98.0.4758.82    • Edge (web)                   • edge             • web-javascript • Microsoft Edge
          97.0.1072.76
    
    [√] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
    [√] Flutter (Channel master, 2.11.0-0.0.pre.554, on Microsoft Windows [Version 10.0.19044.1526],
        locale en-US)
        • Flutter version 2.11.0-0.0.pre.554 at C:\flutter_sdk\master
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 894ef49c7c (4 hours ago), 2022-02-14 22:15:17 -0500
        • Engine revision 8714a2448f
        • Dart version 2.17.0 (build 2.17.0-105.0.dev)
        • DevTools version 2.10.0
    
    [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at C:\Users\mahesh\AppData\Local\Android\sdk
        • Platform android-31, build-tools 31.0.0
        • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web
        • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.4)
        • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
        • Visual Studio Community 2019 version 16.11.31727.386
        • Windows 10 SDK version 10.0.19041.0
    
    [√] Android Studio (version 2020.3)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    
    [√] VS Code (version 1.63.2)
        • VS Code at C:\Users\mahesh\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.34.0
    
    [√] Connected device (5 available)
        • sdk gphone x86 (mobile) • emulator-5554 • android-x86     • Android 11 (API 30) (emulator)
        • Windows (desktop)       • windows       • windows-x64     • Microsoft Windows [Version    
          10.0.19044.1526]
        • Windows (UWP) (desktop) • winuwp        • windows-uwp-x64 • 
        • Chrome (web)            • chrome        • web-javascript  • Google Chrome 98.0.4758.102      
        • Edge (web)              • edge          • web-javascript  • Microsoft Edge 97.0.1072.76      
    
    [√] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
  6. added
    a: tests"flutter test", flutter_test, or one of our tests
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    toolAffects the "flutter" command-line tool. See also t: labels.
    and removed
    in triagePresently being triaged by the triage team
    on Feb 15, 2022
  7. cedvdb commented on Feb 28, 2022

    @cedvdb
    ContributorAuthor

    This is actually blocking here is my use case, I'm trying to create a flutter_cli to accomplish various tasks ranging from icon creation, to running tests:

    Recording 2022-02-28 at 13 43 17

    In this gif pressing ctrl + c does nothing.

    The inability to exit the tests renders the cli unusable, especially for integration tests which can take a long time to run.. The goal being to make this public eventually.

  8. christopherfujino commented on Mar 15, 2022

    @christopherfujino
    Contributor

    I believe this was fixed by #99871. Upgrading your Flutter SDK to any commit past that fix should resolve this (the fix was just updating the bash script to use exec)

  9. added
    r: fixedIssue is closed as already fixed in a newer version
    on Mar 22, 2022
  10. cedvdb commented on Mar 24, 2022

    @cedvdb
    ContributorAuthor

    I just tested this from latest master and the issue persists ( I still cannot quit the test early ) but I'm inclined to think this is an issue with dart since this happens with tools other than flutter too.

  11. github-actions commented on Apr 7, 2022

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  12. locked as resolved and limited conversation to collaborators on Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: tests"flutter test", flutter_test, or one of our testsdependency: dartDart team may need to help usfound in release: 2.10Found to occur in 2.10found in release: 2.11Found to occur in 2.11has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versiontoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions