Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def main()
]
})

await p.status
await p.wait()

if __name__ == "__main__"
main()
Expand All @@ -53,7 +53,7 @@ async def main()
]
})

await p.status
await p.wait()

if __name__ == "__main__"
asyncio.run(main())
Expand Down
10 changes: 4 additions & 6 deletions src/deno_sandbox/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,7 @@ def stderr(self):
# FIXME
pass

@property
def status(self):
def wait(self):
# FIXME
pass

Expand All @@ -556,7 +555,7 @@ async def __aenter__(self):

async def __aexit__(self, exc_type, exc_val, exc_tb):
await self.kill()
await self.status
await self.wait()


class VsCode:
Expand All @@ -576,8 +575,7 @@ def stderr(self):
# FIXME
pass

@property
def status(self):
def wait(self):
# FIXME
pass

Expand All @@ -589,4 +587,4 @@ async def __aenter__(self):

async def __aexit__(self, exc_type, exc_val, exc_tb):
await self.kill()
await self.status
await self.wait()
13 changes: 5 additions & 8 deletions src/deno_sandbox/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ async def create(
) -> AsyncChildProcess:
return create_process_like(cls, res, rpc, options)

@property
async def status(self) -> ChildProcessStatus:
async def wait(self) -> ChildProcessStatus:
raw = await self._wait_task
result = cast(ProcessWaitResult, raw)
return ChildProcessStatus(
Expand Down Expand Up @@ -360,9 +359,8 @@ def __init__(
def pid(self) -> int:
return self._async_proc.pid

@property
def status(self) -> ChildProcessStatus:
return self._rpc._bridge.run(self._async_proc.status)
def wait(self) -> ChildProcessStatus:
return self._rpc._bridge.run(self._async_proc.wait())

def __enter__(self):
return self
Expand Down Expand Up @@ -524,9 +522,8 @@ def returncode(self) -> int | None:
def pid(self) -> int:
return self._async.pid

@property
def status(self) -> ChildProcessStatus:
return self._rpc._bridge.run(self._async.status)
def wait(self) -> ChildProcessStatus:
return self._rpc._bridge.run(self._async.wait())

def __enter__(self):
return self
Expand Down
4 changes: 2 additions & 2 deletions tests/test_sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async def test_spawn_async(async_shared_sandbox) -> None:
},
)

status = await p.status
status = await p.wait()
assert status["code"] == 0

stdout = await p.stdout.read(-1)
Expand All @@ -103,7 +103,7 @@ async def test_spawn_sync(shared_sandbox) -> None:
},
)

status = p.status
status = p.wait()
assert status["code"] == 0

stdout = p.stdout.read(-1)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def test_volume_create_root_async():
async with sdk.sandbox.create({"root": volume["slug"], "region": "ord"}) as sb:
await sb.fs.write_text_file("/app/foo.txt", "foo")
cp = await sb.spawn("sync")
await cp.status
await cp.wait()

await asyncio.sleep(1)

Expand Down