@@ -247,10 +247,9 @@ fn xargo_version() -> Option<(u32, u32, u32)> {
247
247
Some ( ( major, minor, patch) )
248
248
}
249
249
250
- fn ask_to_run ( mut cmd : Command , subcommand : MiriCommand , text : & str ) {
250
+ fn ask_to_run ( mut cmd : Command , ask : bool , text : & str ) {
251
251
// Disable interactive prompts in CI (GitHub Actions, Travis, AppVeyor, etc).
252
- let ask = subcommand != MiriCommand :: Setup && env:: var_os ( "CI" ) . is_none ( ) ;
253
- if ask {
252
+ if ask && env:: var_os ( "CI" ) . is_none ( ) {
254
253
let mut buf = String :: new ( ) ;
255
254
print ! ( "I will run `{:?}` to {}. Proceed? [Y/n] " , cmd, text) ;
256
255
io:: stdout ( ) . flush ( ) . unwrap ( ) ;
@@ -281,6 +280,10 @@ fn setup(subcommand: MiriCommand) {
281
280
return ;
282
281
}
283
282
283
+ // Subcommands other than `setup` will do a setup if necessary, but
284
+ // interactively confirm first.
285
+ let ask_user = subcommand != MiriCommand :: Setup ;
286
+
284
287
// First, we need xargo.
285
288
if xargo_version ( ) . map_or ( true , |v| v < XARGO_MIN_VERSION ) {
286
289
if std:: env:: var ( "XARGO_CHECK" ) . is_ok ( ) {
@@ -289,7 +292,7 @@ fn setup(subcommand: MiriCommand) {
289
292
}
290
293
let mut cmd = cargo ( ) ;
291
294
cmd. args ( & [ "install" , "xargo" , "-f" ] ) ;
292
- ask_to_run ( cmd, subcommand , "install a recent enough xargo" ) ;
295
+ ask_to_run ( cmd, ask_user , "install a recent enough xargo" ) ;
293
296
}
294
297
295
298
// Determine where the rust sources are located. `XARGO_RUST_SRC` env var trumps everything.
@@ -312,7 +315,7 @@ fn setup(subcommand: MiriCommand) {
312
315
cmd. args ( & [ "component" , "add" , "rust-src" ] ) ;
313
316
ask_to_run (
314
317
cmd,
315
- subcommand ,
318
+ ask_user ,
316
319
"install the rustc-src component for the selected toolchain" ,
317
320
) ;
318
321
}
0 commit comments