We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7ebcd0b commit df7d049Copy full SHA for df7d049
hands_on/add_files.py
@@ -1,11 +1,29 @@
1
import os
2
-
3
-from utils.cmd import run_command
+import subprocess
+from sys import exit
4
+from typing import List, Optional
5
6
__requires_git__ = True
7
__requires_github__ = False
8
9
10
+def run_command(command: List[str], verbose: bool) -> Optional[str]:
11
+ try:
12
+ result = subprocess.run(
13
+ command,
14
+ capture_output=True,
15
+ text=True,
16
+ check=True,
17
+ )
18
+ if verbose:
19
+ print(result.stdout)
20
+ return result.stdout
21
+ except subprocess.CalledProcessError as e:
22
23
+ print(e.stderr)
24
+ exit(1)
25
+
26
27
def download(verbose: bool):
28
os.makedirs("things")
29
os.chdir("things")
utils/__init__.py
utils/cmd.py
0 commit comments