From 497fc4f97eea79174d9f82cce1f7bb858e9c581d Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Thu, 2 Sep 2021 06:02:29 +0300 Subject: [PATCH] Set IN_TOPGRADE when running the interactive shell (fix #752) --- src/terminal.rs | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/terminal.rs b/src/terminal.rs index 4d617379..c41eacd0 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -1,12 +1,3 @@ -use crate::report::StepResult; -#[cfg(target_os = "linux")] -use crate::utils::which; -use chrono::{Local, Timelike}; -use console::{style, Key, Term}; -use lazy_static::lazy_static; -use log::{debug, error}; -#[cfg(target_os = "macos")] -use notify_rust::{Notification, Timeout}; use std::cmp::{max, min}; use std::env; use std::io::{self, Write}; @@ -15,9 +6,20 @@ use std::path::PathBuf; use std::process::Command; use std::sync::Mutex; use std::time::Duration; + +use chrono::{Local, Timelike}; +use console::{style, Key, Term}; +use lazy_static::lazy_static; +use log::{debug, error}; +#[cfg(target_os = "macos")] +use notify_rust::{Notification, Timeout}; #[cfg(windows)] use which_crate::which; +use crate::report::StepResult; +#[cfg(target_os = "linux")] +use crate::utils::which; + lazy_static! { static ref TERMINAL: Mutex = Mutex::new(Terminal::new()); } @@ -33,7 +35,12 @@ pub fn shell() -> &'static str { } pub fn run_shell() { - Command::new(shell()).spawn().unwrap().wait().unwrap(); + Command::new(shell()) + .env("IN_TOPGRADE", "1") + .spawn() + .unwrap() + .wait() + .unwrap(); } struct Terminal {