Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c75b3db

Browse files
committed
no chmod on windows
1 parent 6b978fc commit c75b3db

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bin/new.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import argparse
88
import os
9+
import platform
910
import re
1011
import subprocess
1112
import sys
@@ -83,7 +84,10 @@ def main() -> None:
8384
sys.exit('Will not overwrite. Bye!')
8485

8586
print(body(args), file=open(program, 'wt'), end='')
86-
subprocess.run(['chmod', '+x', program])
87+
88+
if platform.system() != 'Windows':
89+
subprocess.run(['chmod', '+x', program], check=True)
90+
8791
print(f'Done, see new script "{program}."')
8892

8993

0 commit comments

Comments
 (0)