forked from ydf0509/nb_log
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
LAPTOP-7V78BBO2\ydf19
committed
Dec 23, 2021
1 parent
492f4d7
commit 5193ce2
Showing
2 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import subprocess | ||
|
||
import time | ||
|
||
def getstatusoutput(cmd): | ||
try: | ||
data = subprocess.check_output(cmd, shell=True, universal_newlines=True, | ||
stderr=subprocess.STDOUT, encoding='utf8') # 必須設置為utf8, 不然报错了。 | ||
exitcode = 0 | ||
except subprocess.CalledProcessError as ex: | ||
data = ex.output | ||
exitcode = ex.returncode | ||
if data[-1:] == '\n': | ||
data = data[:-1] | ||
return exitcode, data | ||
|
||
def do_cmd(cmd_strx): | ||
print(f'执行 {cmd_strx}') | ||
retx = getstatusoutput(cmd_strx) | ||
print(retx[0]) | ||
# if retx[0] !=0: | ||
# raise ValueError('要检查git提交') | ||
print(retx[1], '\n') | ||
return retx | ||
|
||
t0 = time.time() | ||
|
||
do_cmd('git pull') | ||
|
||
do_cmd('git diff') | ||
|
||
do_cmd('git add ../.') | ||
|
||
do_cmd('git commit -m commit') | ||
|
||
|
||
|
||
do_cmd('git push github') | ||
|
||
# print(subprocess.getstatusoutput('git push github')) | ||
print(f'spend_time {time.time() - t0}') | ||
time.sleep(100000) | ||
|
||
|
||
|
||
|
||
|
||
|