Skip to content

fix: flush Android writes before emulator shutdown - #357

Open
janicduplessis wants to merge 1 commit into
mainfrom
@janic/issue-283-flush-before-kill
Open

fix: flush Android writes before emulator shutdown#357
janicduplessis wants to merge 1 commit into
mainfrom
@janic/issue-283-flush-before-kill

Conversation

@janicduplessis

Copy link
Copy Markdown
Collaborator

Description

stim stop and the other centralized Android teardown paths kill a running emulator immediately. Guest writes made just before shutdown can be lost, including a freshly installed APK.

Fixes #283

Solution

Flush the guest filesystem with adb shell sync before emu kill. A sync failure warns on stderr but does not block shutdown, preserving cleanup semantics. The helper is reached only after Stim re-resolves a running AVD as owned.

Test plan

  • Focused Android teardown suites: 99 tests passed; temporarily removing the sync call made the order-sensitive regression test fail.
  • Full checks passed: format, lint, build, typecheck, 3,501 unit tests, and 20 end-to-end tests.
  • Real adb shell sync argument shape verified; persistence was not re-measured on a booted AVD because none was connected.

@janicduplessis
janicduplessis marked this pull request as ready for review September 4, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

adb emu kill loses unflushed guest writes; stop can discard an install

1 participant