()
| 56 | } |
| 57 | |
| 58 | public long[] computeSize() throws RunnerException { |
| 59 | |
| 60 | int r = 0; |
| 61 | try { |
| 62 | String pattern = prefs.get("recipe.size.pattern"); |
| 63 | String cmd[] = StringReplacer.formatAndSplit(pattern, prefs); |
| 64 | |
| 65 | exception = null; |
| 66 | textSize = -1; |
| 67 | dataSize = -1; |
| 68 | eepromSize = -1; |
| 69 | Process process = ProcessUtils.exec(cmd); |
| 70 | MessageSiphon in = new MessageSiphon(process.getInputStream(), this); |
| 71 | MessageSiphon err = new MessageSiphon(process.getErrorStream(), this); |
| 72 | |
| 73 | boolean running = true; |
| 74 | while(running) { |
| 75 | try { |
| 76 | in.join(); |
| 77 | err.join(); |
| 78 | r = process.waitFor(); |
| 79 | running = false; |
| 80 | } catch (InterruptedException intExc) { } |
| 81 | } |
| 82 | } catch (Exception e) { |
| 83 | // The default Throwable.toString() never returns null, but apparently |
| 84 | // some sub-class has overridden it to do so, thus we need to check for |
| 85 | // it. See: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1166589459 |
| 86 | exception = new RunnerException( |
| 87 | (e.toString() == null) ? e.getClass().getName() + r : e.toString() + r); |
| 88 | } |
| 89 | |
| 90 | if (exception != null) |
| 91 | throw exception; |
| 92 | |
| 93 | if (textSize == -1) |
| 94 | throw new RunnerException(firstLine); |
| 95 | |
| 96 | return new long[] { textSize, dataSize, eepromSize }; |
| 97 | } |
| 98 | |
| 99 | @Override |
| 100 | public void message(String s) { |
nothing calls this directly
no test coverage detected