diff --git a/src/blaxel/core/sandbox/default/filesystem.py b/src/blaxel/core/sandbox/default/filesystem.py index 5e87819..37d557d 100644 --- a/src/blaxel/core/sandbox/default/filesystem.py +++ b/src/blaxel/core/sandbox/default/filesystem.py @@ -377,7 +377,7 @@ async def cp(self, source: str, destination: str, max_wait: int = 180000) -> Cop return CopyResponse(message="Files copied", source=source, destination=destination) - def watch( + async def watch( self, path: str, callback: Callable[[WatchEvent], None], @@ -393,7 +393,7 @@ def watch( Or manually: - handle = sandbox.fs.watch(path, callback) + handle = await sandbox.fs.watch(path, callback) try: # do something finally: diff --git a/tests/integration/core/sandbox/test_filesystem.py b/tests/integration/core/sandbox/test_filesystem.py index 6206055..9587c16 100644 --- a/tests/integration/core/sandbox/test_filesystem.py +++ b/tests/integration/core/sandbox/test_filesystem.py @@ -388,7 +388,7 @@ def on_change(event): if event.name == "watched-file.txt": change_detected = True - handle = self.sandbox.fs.watch(dir_path, on_change) + handle = await self.sandbox.fs.watch(dir_path, on_change) try: await async_sleep(0.5) diff --git a/tests/integration/core/sandbox/test_sessions.py b/tests/integration/core/sandbox/test_sessions.py index 1ac54d7..fbce33a 100644 --- a/tests/integration/core/sandbox/test_sessions.py +++ b/tests/integration/core/sandbox/test_sessions.py @@ -180,7 +180,7 @@ def on_change(event): nonlocal change_detected change_detected = True - handle = sandbox_from_session.fs.watch("/", on_change) + handle = await sandbox_from_session.fs.watch("/", on_change) try: await async_sleep(0.5) # Wait for watch to be established await sandbox_from_session.fs.write("/session-test.txt", "content")