shell: handle Path objects

Pull in updates from CrOS code.

Bug: 229737306
Test: unittests pass
Change-Id: Ib5f1743db9e77b77a3b3182cc696130137674fa8
diff --git a/rh/utils_unittest.py b/rh/utils_unittest.py
index 586dfcc..7928dd5 100755
--- a/rh/utils_unittest.py
+++ b/rh/utils_unittest.py
@@ -17,6 +17,7 @@
 
 import datetime
 import os
+from pathlib import Path
 import sys
 import unittest
 
@@ -215,6 +216,13 @@
         self.assertNotEqual(0, err.returncode)
         self.assertIn('a/b/c/d', str(err))
 
+    def test_pathlib(self):
+        """Verify pathlib arguments work."""
+        result = rh.utils.run(['true', Path('/')])
+        # Verify stringify behavior.
+        str(result)
+        self.assertEqual(result.cmdstr, 'true /')
+
 
 if __name__ == '__main__':
     unittest.main()