From 99fa19c36c8401699dadd3038cea65480bc20311 Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Thu, 2 Apr 2015 11:20:53 +0200 Subject: [PATCH] Letting postInstallScript fails gracefully --- .../contributions/packages/ContributionInstaller.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arduino-core/src/cc/arduino/contributions/packages/ContributionInstaller.java b/arduino-core/src/cc/arduino/contributions/packages/ContributionInstaller.java index 8de07110b..396569726 100644 --- a/arduino-core/src/cc/arduino/contributions/packages/ContributionInstaller.java +++ b/arduino-core/src/cc/arduino/contributions/packages/ContributionInstaller.java @@ -192,10 +192,16 @@ public class ContributionInstaller { ByteArrayOutputStream stderr = new ByteArrayOutputStream(); Executor executor = new CollectStdOutStdErrExecutor(stdout, stderr); executor.setWorkingDirectory(folder); - executor.execute(new CommandLine(postInstallScript)); + executor.setExitValues(null); + int exitValue = executor.execute(new CommandLine(postInstallScript)); + executor.setExitValues(new int[0]); System.out.write(stdout.toByteArray()); System.err.write(stderr.toByteArray()); + + if (executor.isFailure(exitValue)) { + throw new IOException(); + } } public List remove(ContributedPlatform platform) {