flutter.el icon indicating copy to clipboard operation
flutter.el copied to clipboard

Interaction with running flutter process exits prematurely on Windows

Open jcs090218 opened this issue 1 year ago • 7 comments

When I try flutter-run, then I got the following error:

More than one device connected; please specify a device with the '-d <deviceId>' flag, or use '-d all' to act on all devices.

<list of devices>

Process Flutter exited abnormally with code 1

Does this package support entering the device id?

jcs090218 avatar Aug 08 '23 23:08 jcs090218

When I run flutter-run with multiple devices available, I get a prompt that lets me interactively choose the device:

Checking for wireless devices...

Connected devices:
Pixel 2 (mobile)           • xxxxxxxxxxxx              • android-arm64  • Android 11 (API 30)
Aaron’s iPhone Xꜱ (mobile) • xxxxxxxx-xxxxxxxxxxxxxxxx • ios            • iOS 16.6 20G75
Chrome (web)               • chrome                    • web-javascript • Google Chrome 115.0.5790.170
[1]: Pixel 2 (xxxxxxxxxxxx)
[2]: Aaron’s iPhone Xꜱ (xxxxxxxx-xxxxxxxxxxxxxxxx)
[3]: Chrome (chrome)
Please choose one (or "q" to quit): 1
1
Launching lib/main.dart on Pixel 2 in debug mode...
Running Gradle task 'assembleDebug'...                          

What versions of Flutter and Emacs are you using?

amake avatar Aug 10 '23 00:08 amake

I get a prompt that lets me interactively choose the device:

That's what I was expecting. I get the prompt in the terminal, but not with this package. 🤔

flutter --version:

Flutter 3.10.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f468f3366c (4 weeks ago) • 2023-07-12 15:19:05 -0700
Engine • revision cdbeda788a
Tools • Dart 3.0.6 • DevTools 2.23.1

Emacs 29.1 and on Windows 11.

jcs090218 avatar Aug 10 '23 02:08 jcs090218

My best guess is that either Flutter or Emacs behaves differently on Windows.

flutter-run starts the flutter process with make-comint-in-buffer. I tried to look into how that works to see if there were any relevant code paths that might explain the difference, but I didn't see any.

At the moment the only workaround is this: https://github.com/amake/flutter.el/issues/1#issuecomment-490685690

amake avatar Aug 10 '23 04:08 amake

If you run (flutter-run "-d all") (or -d 1 or whatever), does the app start and can you interact with the flutter process with the usual keys? (r to refresh, etc.)

amake avatar Aug 10 '23 04:08 amake

If you run (flutter-run "-d all") (or -d 1 or whatever), does the app start

The app starts! But do we have to define the command ourselves? 🤔 It will be nice if we could just customize the arguments.

can you interact with the flutter process with the usual keys?

Yes, it works! However, it turns out I will get the same result in the first post (Process Flutter exited abnormally with code 1).

jcs090218 avatar Aug 10 '23 04:08 jcs090218

It will be nice if we could just customize the arguments.

You can make your own function and bind it as you like, per the comment I linked earlier.

Yes, it works! However, it turns out I will get the same result in the first post (Process Flutter exited abnormally with code 1).

OK so it sounds like interactivity just doesn't work correctly on your setup. That's the real bug here, so I will keep this ticket open but clarify the title.

For improving the UI for choosing a device, see #1.

amake avatar Aug 10 '23 04:08 amake

You can make your own function and bind it as you like, per the comment I linked earlier.

I mean, I was hoping for a built-in solution from this package, so I don't have to define it myself.

For improving the UI for choosing a device, see https://github.com/amake/flutter.el/issues/1.

👍 Thank you for the reply. It's very helpful! :D

jcs090218 avatar Aug 10 '23 04:08 jcs090218