Skip to content

Commit

Permalink
Delaying fs sync to ensure shutdown message is logged to disk
Browse files Browse the repository at this point in the history
Signed-off-by: grokbeer <[email protected]>
  • Loading branch information
grokbeer committed May 8, 2020
1 parent 05b235c commit 71514a9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pwnagotchi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,20 @@ def temperature(celsius=True):


def shutdown():
logging.warning("syncing...")

from pwnagotchi import fs
for m in fs.mounts:
m.sync()

logging.warning("shutting down ...")

from pwnagotchi.ui import view
if view.ROOT:
view.ROOT.on_shutdown()
# give it some time to refresh the ui
time.sleep(10)

logging.warning("syncing...")

from pwnagotchi import fs
for m in fs.mounts:
m.sync()

os.system("sync")
os.system("halt")

Expand Down

0 comments on commit 71514a9

Please sign in to comment.