@@ -2,16 +2,20 @@ pub fn install_env(env: &str) {
2
2
match env {
3
3
"python" => {
4
4
println ! ( "\x1b [32m[xtask]\x1b [0m Checking if Python is already installed..." ) ;
5
+ println ! ( ) ;
6
+
5
7
// Check if python or python3 is installed
6
8
let check_installed = if cfg ! ( target_os = "windows" ) {
7
9
std:: process:: Command :: new ( "python" )
8
10
. arg ( "--version" )
11
+ . stdout ( std:: process:: Stdio :: null ( ) )
9
12
. status ( )
10
13
. map ( |s| s. success ( ) )
11
14
. unwrap_or ( false )
12
15
} else {
13
16
std:: process:: Command :: new ( "python3" )
14
17
. arg ( "--version" )
18
+ . stdout ( std:: process:: Stdio :: null ( ) )
15
19
. status ( )
16
20
. map ( |s| s. success ( ) )
17
21
. unwrap_or ( false )
@@ -40,6 +44,7 @@ pub fn install_env(env: &str) {
40
44
std:: process:: Command :: new ( "sh" )
41
45
. arg ( "-c" )
42
46
. arg ( format ! ( "command -v {}" , cmd) )
47
+ . stdout ( std:: process:: Stdio :: null ( ) )
43
48
. status ( )
44
49
. map ( |s| s. success ( ) )
45
50
. unwrap_or ( false )
@@ -95,9 +100,12 @@ pub fn install_env(env: &str) {
95
100
}
96
101
"xmake" => {
97
102
println ! ( "\x1b [32m[xtask]\x1b [0m Checking if xmake is already installed..." ) ;
103
+ println ! ( ) ;
104
+
98
105
// Check if xmake is installed
99
106
let check_installed = std:: process:: Command :: new ( "xmake" )
100
107
. arg ( "--version" )
108
+ . stdout ( std:: process:: Stdio :: null ( ) )
101
109
. status ( )
102
110
. map ( |s| s. success ( ) )
103
111
. unwrap_or ( false ) ;
@@ -140,9 +148,12 @@ pub fn install_env(env: &str) {
140
148
}
141
149
"cuda" => {
142
150
println ! ( "\x1b [32m[xtask]\x1b [0m Checking if CUDA Toolkit is already installed..." ) ;
151
+ println ! ( ) ;
152
+
143
153
// Check if cuda toolkit is installed
144
154
let check_installed = std:: process:: Command :: new ( "nvcc" )
145
155
. arg ( "--version" )
156
+ . stdout ( std:: process:: Stdio :: null ( ) )
146
157
. status ( )
147
158
. map ( |s| s. success ( ) )
148
159
. unwrap_or ( false ) ;
@@ -156,6 +167,7 @@ pub fn install_env(env: &str) {
156
167
157
168
// nvidia-smi, get the highest CUDA version supported by the driver
158
169
let has_nvidia_smi = std:: process:: Command :: new ( "nvidia-smi" )
170
+ . stdout ( std:: process:: Stdio :: null ( ) )
159
171
. status ( )
160
172
. map ( |s| s. success ( ) )
161
173
. unwrap_or ( false ) ;
@@ -170,7 +182,7 @@ pub fn install_env(env: &str) {
170
182
println ! ( "\x1b [32m[xtask]\x1b [0m Detected by nvidia-smi: {line}" ) ;
171
183
}
172
184
if let Some ( idx) = line. find ( "CUDA Version:" ) {
173
- // 提取 CUDA 版本号
185
+ // extract the CUDA version number
174
186
let version_str = line[ idx + "CUDA Version:" . len ( ) ..]
175
187
. split_whitespace ( )
176
188
. next ( )
@@ -192,8 +204,7 @@ pub fn install_env(env: &str) {
192
204
) ;
193
205
}
194
206
195
- // println!("\x1b[32m[xtask]\x1b[0m CUDA Toolkit not detected. Installing CUDA Toolkit...");
196
-
207
+ println ! ( ) ;
197
208
println ! (
198
209
"\x1b [32m[xtask]\x1b [0m Please visit https://developer.nvidia.com/cuda-toolkit-archive to select and download the appropriate CUDA version for your driver."
199
210
) ;
0 commit comments