Browse Source

fix: add platform-specific pause command for Windows

liuyuqi-dellpc 2 weeks ago
parent
commit
3d1c3c2a46
1 changed files with 9 additions and 4 deletions
  1. 9 4
      auto_commit/auto_commit.py

+ 9 - 4
auto_commit/auto_commit.py

@@ -6,6 +6,7 @@
 @License :   Copyright © 2017-2022 liuyuqi. All Rights Reserved.
 @Desc    :   auto commit
 """
+from curses import window
 import os
 from auto_commit.utils.colors import bcolors
 
@@ -55,8 +56,10 @@ class AutoCommit(object):
             for root, dirs, files in os.walk(self.params['path']):
                 if ".git" in dirs:
                     self._check(root)
-        os.system("pause")
-
+        if os.name == "nt":
+            os.system("pause")         # linux without this comoand
+        # else:  # Linux or other Unix-like systems
+        #     os.system("read -n 1 -s -r -p 'Press any key to continue...'")
 
     def commit(self):
         """ run """
@@ -66,7 +69,8 @@ class AutoCommit(object):
             for root, dirs, files in os.walk(self.params['path']):
                 if ".git" in dirs:
                     self._commit(root)
-        os.system("pause")
+        if os.name == "nt":
+            os.system("pause")
     
     def sync(self):
         """ sync """
@@ -76,4 +80,5 @@ class AutoCommit(object):
             for root, dirs, files in os.walk(self.params['path']):
                 if ".git" in dirs:
                     self._sync(root)
-        os.system("pause")
+        if os.name == "nt":
+            os.system("pause")