@@ -40,10 +40,22 @@ def check_node_installed(self):
40
40
EnvironmentError: If Node.js is not installed or not found in PATH.
41
41
"""
42
42
try :
43
- result = subprocess .run (['node' , '--version' ],env = os .environ , capture_output = True , text = True , check = True )
44
- self .cprint (f"✓ Node.js is installed: { result .stdout .strip ()} " ,"green" )
43
+ process = subprocess .Popen (['node' , '--version' ],
44
+ env = os .environ ,
45
+ stdout = subprocess .PIPE ,
46
+ stderr = subprocess .PIPE ,
47
+ text = True )
48
+ stdout , stderr = process .communicate ()
49
+ if process .returncode != 0 :
50
+ raise subprocess .CalledProcessError (process .returncode , process .args , stdout , stderr )
51
+
52
+ self .cprint (f"✓ Node.js is installed: { stdout .strip ()} " , "green" )
45
53
except subprocess .CalledProcessError as e :
46
- raise EnvironmentError ("Node.js is not installed or not found in PATH. Please install Node.js to proceed." ) from e
54
+ self .cprint (f"✗ Error checking Node.js version: { e .stderr .strip ()} " , "red" )
55
+ raise
56
+ except Exception as e :
57
+ self .cprint (f"✗ Unexpected error occurred: { str (e )} " , "red" )
58
+ raise
47
59
48
60
def check_mystmd_installed (self ):
49
61
"""
@@ -53,10 +65,21 @@ def check_mystmd_installed(self):
53
65
EnvironmentError: If MyST markdown tool is not installed or not found in PATH.
54
66
"""
55
67
try :
56
- result = subprocess .run ([self .executable , '--version' ],env = os .environ , capture_output = True , text = True , check = True )
57
- self .cprint (f"✓ mystmd is installed: { result .stdout .strip ()} " ,"green" )
68
+ process = subprocess .Popen ([self .executable , '--version' ],
69
+ env = os .environ ,
70
+ stdout = subprocess .PIPE ,
71
+ stderr = subprocess .PIPE ,
72
+ text = True )
73
+ stdout , stderr = process .communicate ()
74
+ if process .returncode != 0 :
75
+ raise subprocess .CalledProcessError (process .returncode , process .args , stdout , stderr )
76
+ self .cprint (f"✓ mystmd is installed: { stdout .strip ()} " ,"green" )
58
77
except subprocess .CalledProcessError as e :
59
- raise EnvironmentError (f"{ self .executable } is not installed or not found in PATH. Please install mystmd to proceed." ) from e
78
+ self .cprint (f"✗ Error checking myst version: { e .stderr .strip ()} " , "red" )
79
+ raise
80
+ except Exception as e :
81
+ self .cprint (f"✗ Unexpected error occurred: { str (e )} " , "red" )
82
+ raise
60
83
61
84
def run_command (self , * args , env_vars = {}):
62
85
"""
0 commit comments