Skip to content

Commit 6bf3d73

Browse files
committed
Trim output when logging ADB errors + add exit code to adb errors
1 parent ac5309b commit 6bf3d73

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

QuestPatcher.Core/AndroidDebugBridge.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public async Task<ProcessOutput> RunCommand(string command, params int[] allowed
273273
// -1073740940 is always allowed as some ADB installations return it randomly, even when commands are successful.
274274
if (output.ExitCode == 0 || allowedExitCodes.Contains(output.ExitCode) || output.ExitCode == -1073740940) { return output; }
275275

276-
string allOutput = output.StandardOutput + output.ErrorOutput;
276+
string allOutput = (output.StandardOutput + output.ErrorOutput).Trim();
277277

278278
// We repeatedly prompt the user to plug in their quest if it is not plugged in, or the device is offline, or if there are multiple devices
279279
if (allOutput.Contains("no devices/emulators found"))
@@ -295,7 +295,8 @@ public async Task<ProcessOutput> RunCommand(string command, params int[] allowed
295295
else
296296
{
297297
// Throw an exception as ADB gave a non-zero exit code so the command must've failed
298-
throw new AdbException(allOutput);
298+
// Add the exit code to the error message for debugging purposes.
299+
throw new AdbException($"Code {output.ExitCode}: {allOutput}");
299300
}
300301
}
301302
}

0 commit comments

Comments
 (0)