Skip to content

Commit 4329ff8

Browse files
committed
Vec<u8> in FailedCommand
1 parent 06e8264 commit 4329ff8

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

plugins/java/src/ant.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ impl LanguagePlugin for AntPlugin {
178178
Err(JavaError::FailedCommand(
179179
"ant clean".to_string(),
180180
output.status,
181-
output.stdout,
182-
output.stderr,
181+
String::from_utf8_lossy(&output.stdout).into_owned(),
182+
String::from_utf8_lossy(&output.stderr).into_owned(),
183183
)
184184
.into())
185185
}

plugins/java/src/error.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ pub enum JavaError {
1616
InvalidExercise(PathBuf),
1717
#[error("Failed to run {0}")]
1818
FailedToRun(String, #[source] std::io::Error),
19-
#[error(r"Command '{0}' exited with a exit status {1}
19+
#[error(
20+
r"Command '{0}' exited with a exit status {1}
2021
#### STDOUT ####
21-
{}
22+
{2}
2223
#### STDERR ####
23-
{}", String::from_utf8_lossy(&.2), String::from_utf8_lossy(&.3))]
24-
FailedCommand(String, ExitStatus, Vec<u8>, Vec<u8>),
24+
{3}"
25+
)]
26+
FailedCommand(String, ExitStatus, String, String),
2527
#[error("Failed to write temporary .jar file {0}")]
2628
JarWrite(PathBuf, #[source] io::Error),
2729
#[error("Failed to create file at {0}")]

plugins/java/src/maven.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ impl LanguagePlugin for MavenPlugin {
137137
return Err(JavaError::FailedCommand(
138138
"mvn".to_string(),
139139
output.status,
140-
output.stdout,
141-
output.stderr,
140+
String::from_utf8_lossy(&output.stdout).into_owned(),
141+
String::from_utf8_lossy(&output.stderr).into_owned(),
142142
)
143143
.into());
144144
}
@@ -186,8 +186,8 @@ impl JavaPlugin for MavenPlugin {
186186
return Err(JavaError::FailedCommand(
187187
mvn_path.as_os_str().to_string_lossy().to_string(),
188188
output.status,
189-
output.stdout,
190-
output.stderr,
189+
String::from_utf8_lossy(&output.stdout).into_owned(),
190+
String::from_utf8_lossy(&output.stderr).into_owned(),
191191
));
192192
}
193193

@@ -229,8 +229,8 @@ impl JavaPlugin for MavenPlugin {
229229
return Err(JavaError::FailedCommand(
230230
mvn_path.as_os_str().to_string_lossy().to_string(),
231231
output.status,
232-
output.stdout,
233-
output.stderr,
232+
String::from_utf8_lossy(&output.stdout).into_owned(),
233+
String::from_utf8_lossy(&output.stderr).into_owned(),
234234
));
235235
}
236236

@@ -264,8 +264,8 @@ impl JavaPlugin for MavenPlugin {
264264
return Err(JavaError::FailedCommand(
265265
mvn_path.as_os_str().to_string_lossy().to_string(),
266266
output.status,
267-
output.stdout,
268-
output.stderr,
267+
String::from_utf8_lossy(&output.stdout).into_owned(),
268+
String::from_utf8_lossy(&output.stderr).into_owned(),
269269
));
270270
}
271271

plugins/java/src/plugin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ pub(crate) trait JavaPlugin: LanguagePlugin {
127127
return Err(JavaError::FailedCommand(
128128
"java".to_string(),
129129
output.status,
130-
output.stdout,
131-
output.stderr,
130+
String::from_utf8_lossy(&output.stdout).into_owned(),
131+
String::from_utf8_lossy(&output.stderr).into_owned(),
132132
));
133133
}
134134

0 commit comments

Comments
 (0)