use login shell when executing topgrade (#1327)

This commit is contained in:
SteveCoding125
2025-09-18 17:06:59 +02:00
committed by GitHub
parent ccefd0a43a
commit 898823abb2

View File

@@ -149,12 +149,12 @@ fn upgrade_wsl_distribution(wsl: &Path, dist: &str, ctx: &ExecutionContext) -> R
//
// ```rust
// command
// .args(["-d", dist, "bash", "-c"])
// .args(["-d", dist, "bash", "-lc"])
// .arg(format!("TOPGRADE_PREFIX={dist} exec {topgrade}"));
// ```
//
// creates a command string like:
// > `C:\WINDOWS\system32\wsl.EXE -d Ubuntu bash -c 'TOPGRADE_PREFIX=Ubuntu exec /bin/topgrade'`
// > `C:\WINDOWS\system32\wsl.EXE -d Ubuntu bash -lc 'TOPGRADE_PREFIX=Ubuntu exec /bin/topgrade'`
//
// Adding the following:
//
@@ -163,7 +163,7 @@ fn upgrade_wsl_distribution(wsl: &Path, dist: &str, ctx: &ExecutionContext) -> R
// ```
//
// appends the next argument like so:
// > `C:\WINDOWS\system32\wsl.EXE -d Ubuntu bash -c 'TOPGRADE_PREFIX=Ubuntu exec /bin/topgrade' -v`
// > `C:\WINDOWS\system32\wsl.EXE -d Ubuntu bash -lc 'TOPGRADE_PREFIX=Ubuntu exec /bin/topgrade' -v`
// which means `-v` isn't passed to `topgrade`.
let mut args = String::new();
if ctx.config().verbose() {
@@ -171,7 +171,7 @@ fn upgrade_wsl_distribution(wsl: &Path, dist: &str, ctx: &ExecutionContext) -> R
}
command
.args(["-d", dist, "bash", "-c"])
.args(["-d", dist, "bash", "-lc"])
.arg(format!("TOPGRADE_PREFIX={dist} exec {topgrade} {args}"));
if ctx.config().yes(Step::Wsl) {