Skip to content

Commit 3a25ac6

Browse files
committed
proxy: Honour RUSTUP_FORCE_ARG0 in proxy mode
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
1 parent a1d5912 commit 3a25ac6

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

src/bin/rustup-init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ fn run_rustup_inner() -> Result<utils::ExitCode> {
9595
}
9696
Some(n) => {
9797
if TOOLS.iter().chain(DUP_TOOLS.iter()).any(|&name| name == n) {
98-
proxy_mode::main()
98+
proxy_mode::main(n)
9999
} else {
100100
Err(anyhow!(format!(
101101
"unknown proxy name: '{}'; valid proxy names are {}",

src/cli/proxy_mode.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
11
use std::ffi::OsString;
2-
use std::path::PathBuf;
32
use std::process;
43

54
use anyhow::Result;
65

76
use super::common::set_globals;
8-
use super::errors::*;
97
use super::job;
108
use super::self_update;
119
use crate::command::run_command_for_dir;
1210
use crate::utils::utils::{self, ExitCode};
1311
use crate::Cfg;
1412

15-
pub fn main() -> Result<ExitCode> {
13+
pub fn main(arg0: &str) -> Result<ExitCode> {
1614
self_update::cleanup_self_updater()?;
1715

1816
let ExitCode(c) = {
1917
let _setup = job::setup();
2018

21-
let mut args = crate::process().args_os();
22-
23-
let arg0 = args.next().map(PathBuf::from);
24-
let arg0 = arg0
25-
.as_ref()
26-
.and_then(|a| a.file_name())
27-
.and_then(std::ffi::OsStr::to_str);
28-
let arg0 = arg0.ok_or(CLIError::NoExeName)?;
19+
let mut args = crate::process().args_os().skip(1);
2920

3021
// Check for a toolchain specifier.
3122
let arg1 = args.next();

0 commit comments

Comments
 (0)