Skip to content

Commit

Permalink
fs: add pwd
Browse files Browse the repository at this point in the history
  • Loading branch information
yotamolenik committed Feb 3, 2022
1 parent da30b14 commit 8cc4bf8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/pyzshell/pyzshell/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,13 @@ def symlink(self, target: str, linkpath: str) -> int:
if err < 0:
raise ZShellError(f'symlink failed for {target} and {linkpath}')
return err

def pwd(self) -> str:
""" calls getcwd(buf, size_t) and prints current path.
with the special values NULL,NULL the buffer is allocated dynamically """
chunk = self._client.symbols.getcwd(0, 0)
if chunk == 0:
raise ZShellError('pwd failed.')
buf = chunk.peek_str()
self._client.symbols.free(chunk)
return buf

0 comments on commit 8cc4bf8

Please sign in to comment.