ALPHA: wire is a tool to deploy nixos systems wire.althaea.zone/
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

strip potential junk in front of `@nix`

+17 -7
+2 -1
wire/lib/src/commands/interactive.rs
··· 241 241 242 242 fn build_command<S: AsRef<str>>( 243 243 arguments: &CommandArguments<'_, S>, 244 - command_string: &String 244 + command_string: &String, 245 245 ) -> Result<CommandBuilder, HiveLibError> { 246 246 let mut command = if let Some(target) = arguments.target { 247 247 let mut command = create_sync_ssh_command(target, arguments.modifiers)?; ··· 324 324 .unwrap() 325 325 .iter() 326 326 .rev() 327 + .map(|x| x.trim()) 327 328 .join("\n"); 328 329 329 330 return Ok((exit_status, logs));
+15 -6
wire/lib/src/commands/mod.rs
··· 7 7 }; 8 8 9 9 use nix_compat::log::{AT_NIX_PREFIX, LogMessage}; 10 + use tracing::debug; 10 11 11 12 use crate::{ 12 13 SubCommandModifiers, ··· 144 145 fn trace(self, line: &String) -> nix_log::SubcommandLog<'_> { 145 146 let log = match self { 146 147 ChildOutputMode::Nix => { 147 - let log = serde_json::from_str::<LogMessage>( 148 - line.strip_prefix(AT_NIX_PREFIX).unwrap_or(line), 149 - ) 150 - .map(SubcommandLog::Internal) 151 - .unwrap_or(SubcommandLog::Raw(line.into())); 148 + let stripped = line 149 + .find(AT_NIX_PREFIX) 150 + .map(|position| &line[position + AT_NIX_PREFIX.len()..]); 152 151 153 - log 152 + if let Some(line) = stripped { 153 + serde_json::from_str::<LogMessage>(line).map_or_else( 154 + |err| { 155 + debug!("failed to parse {line:?}: {err:?}"); 156 + SubcommandLog::Raw(line.into()) 157 + }, 158 + SubcommandLog::Internal, 159 + ) 160 + } else { 161 + SubcommandLog::Raw(line.into()) 162 + } 154 163 } 155 164 Self::Raw => SubcommandLog::Raw(line.into()), 156 165 };