| 43 | } |
| 44 | |
| 45 | fn run_at(&self, work: &Path, args: &[&str]) -> Output { |
| 46 | let mut command = Command::new(&self.binary); |
| 47 | for (name, _) in std::env::vars_os() { |
| 48 | if name.to_string_lossy().starts_with("ATOMIC_") |
| 49 | || name.to_string_lossy().starts_with("GIT_") |
| 50 | { |
| 51 | command.env_remove(name); |
| 52 | } |
| 53 | } |
| 54 | command |
| 55 | .args(args) |
| 56 | .current_dir(work) |
| 57 | .env("HOME", self.home.path()) |
| 58 | .env("ATOMIC_HOME", self.home.path().join(".atomic")) |
| 59 | .env("ATOMIC_CONFIG_DIR", self.home.path().join(".atomic")) |
| 60 | .env("ATOMIC_NONINTERACTIVE", "1") |
| 61 | .env("XDG_CONFIG_HOME", self.home.path().join(".config")) |
| 62 | .env("XDG_DATA_HOME", self.home.path().join(".local/share")) |
| 63 | .env("XDG_CACHE_HOME", self.home.path().join(".cache")) |
| 64 | .env("XDG_STATE_HOME", self.home.path().join(".local/state")) |
| 65 | .env("GIT_CONFIG_NOSYSTEM", "1") |
| 66 | .env("GIT_CONFIG_GLOBAL", "/dev/null") |
| 67 | .env("NO_COLOR", "1") |
| 68 | .output() |
| 69 | .expect("run atomic") |
| 70 | } |
| 71 | |
| 72 | fn ok_at(&self, work: &Path, args: &[&str]) -> String { |
| 73 | let output = self.run_at(work, args); |