Exercise lock release on a cold terminal launch
Co-Authored-By: GPT-6 Codex (xhigh) <noreply@openai.com>
This commit is contained in:
1 parent
341299f477
commit
01e1a8de0f
1 file changed
+18
@@ -2,6 +2,7 @@
|
|||||||
"""Exercise the packaged entry point with a disposable HOME and installer."""
|
"""Exercise the packaged entry point with a disposable HOME and installer."""
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import pty
|
||||||
import signal
|
import signal
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -202,6 +203,23 @@ if os.environ.get('TEST_GUI_WAIT'): time.sleep(30)
|
|||||||
lock=self.home/'.hermes/.omarchy-hermes-desktop.lock'
|
lock=self.home/'.hermes/.omarchy-hermes-desktop.lock'
|
||||||
self.assertEqual(subprocess.run(['flock','--nonblock',str(lock),'true']).returncode,0)
|
self.assertEqual(subprocess.run(['flock','--nonblock',str(lock),'true']).returncode,0)
|
||||||
|
|
||||||
|
def test_cold_terminal_launch_releases_lock_before_exec(self):
|
||||||
|
master,slave=pty.openpty()
|
||||||
|
process=subprocess.Popen(['bash',str(self.base/'launcher')],stdin=slave,stdout=slave,stderr=slave,env=self.env | {'TEST_GUI_WAIT':'1'})
|
||||||
|
os.close(slave)
|
||||||
|
def cleanup():
|
||||||
|
if process.poll() is None: process.terminate()
|
||||||
|
process.wait(timeout=5)
|
||||||
|
os.close(master)
|
||||||
|
self.addCleanup(cleanup)
|
||||||
|
for _ in range(100):
|
||||||
|
if self.output.exists(): break
|
||||||
|
time.sleep(.02)
|
||||||
|
self.assertTrue(self.output.exists())
|
||||||
|
self.assertIsNone(process.poll())
|
||||||
|
lock=self.home/'.hermes/.omarchy-hermes-desktop.lock'
|
||||||
|
self.assertEqual(subprocess.run(['flock','--nonblock',str(lock),'true']).returncode,0)
|
||||||
|
|
||||||
def test_pending_marker_overrides_old_completion(self):
|
def test_pending_marker_overrides_old_completion(self):
|
||||||
self.install()
|
self.install()
|
||||||
(self.root/'.omarchy-hermes-desktop').write_text('pending\n')
|
(self.root/'.omarchy-hermes-desktop').write_text('pending\n')
|
||||||
|
|||||||
Reference in new issue
Block a user