Browse Source

chdir: be verbose

Fabian Peter Hammerle 5 years ago
parent
commit
e2fa3ec2b0
1 changed files with 3 additions and 0 deletions
  1. 3 0
      rc.xsh

+ 3 - 0
rc.xsh

@@ -180,12 +180,15 @@ class StdoutTee:
 
 @contextlib.contextmanager
 def chdir(path):
+    import shlex
     previous = os.getcwd()
     try:
+        sys.stderr.write('cd {}\n'.format(shlex.quote(path)))
         os.chdir(path)
         yield path
     finally:
         os.chdir(previous)
+        sys.stderr.write('cd {}\n'.format(shlex.quote(previous)))
 
 def dpkg_listfiles(pkg_name):
     assert isinstance(pkg_name, str)