mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
To convince `xcdevice observe` to redirect to stdout it's being launched in an interactive shell `/usr/bin/script -t 0 /dev/null /usr/bin/arch -arm64e xcrun xcdevice observe --usb`
1cc8a07ace/packages/flutter_tools/lib/src/macos/xcdevice.dart (L261-L263)
When the `flutter` command exits, the interactive script process is terminated, but not its jobs `xcdevice observe --usb`.
Instead of `-9` sigterm killing the interactive script, send it a [`SIGHUP`](https://linux.die.net/Bash-Beginners-Guide/sect_12_01.html#sect_12_01_01_02) (signal hangup) during `XCDevice.dispose()`, which will exit its processes. Add a shutdown hook to ensure `dispose` is run when the process exits.
Fixes https://github.com/flutter/flutter/issues/73859