Parcourir la source

Fix windows line endings in utility script (#5162)

* Fix windows line endings

* Avoid permission error when removing temporary directory

* Use trimEnd

* Use explicit line ending replacement
Steven Silvester il y a 6 ans
Parent
commit
c03a8f1615
2 fichiers modifiés avec 8 ajouts et 2 suppressions
  1. 4 1
      buildutils/src/utils.ts
  2. 4 1
      jupyterlab/tests/test_app.py

+ 4 - 1
buildutils/src/utils.ts

@@ -75,5 +75,8 @@ export function run(
   if (value === null) {
     return '';
   }
-  return value.toString().replace(/\n$/, '');
+  return value
+    .toString()
+    .replace(/(\r\n|\n)$/, '')
+    .trim();
 }

+ 4 - 1
jupyterlab/tests/test_app.py

@@ -124,7 +124,10 @@ class _test_env(object):
     def stop(self):
         self.env_patch.stop()
         self.path_patch.stop()
-        self.test_dir.cleanup()
+        try:
+            self.test_dir.cleanup()
+        except PermissionError as e:
+            pass
 
     def __enter__(self):
         self.start()