• ■ ■ ■ ■
    commons-codeassist/pom.xml
    skipped 4 lines
    5 5   <parent>
    6 6   <groupId>io.onedev</groupId>
    7 7   <artifactId>commons</artifactId>
    8  - <version>2.0.5</version>
     8 + <version>2.0.6</version>
    9 9   </parent>
    10 10   <build>
    11 11   <plugins>
    skipped 68 lines
  • ■ ■ ■ ■
    commons-jsymbol/pom.xml
    skipped 3 lines
    4 4   <parent>
    5 5   <groupId>io.onedev</groupId>
    6 6   <artifactId>commons</artifactId>
    7  - <version>2.0.5</version>
     7 + <version>2.0.6</version>
    8 8   </parent>
    9 9   <artifactId>commons-jsymbol</artifactId>
    10 10   <build>
    skipped 148 lines
  • ■ ■ ■ ■
    commons-jsyntax/pom.xml
    skipped 3 lines
    4 4   <parent>
    5 5   <groupId>io.onedev</groupId>
    6 6   <artifactId>commons</artifactId>
    7  - <version>2.0.5</version>
     7 + <version>2.0.6</version>
    8 8   </parent>
    9 9   <artifactId>commons-jsyntax</artifactId>
    10 10   <dependencies>
    skipped 46 lines
  • ■ ■ ■ ■
    commons-launcher/commons-launcher-bootstrap/pom.xml
    skipped 3 lines
    4 4   <parent>
    5 5   <groupId>io.onedev</groupId>
    6 6   <artifactId>commons-launcher</artifactId>
    7  - <version>2.0.5</version>
     7 + <version>2.0.6</version>
    8 8   </parent>
    9 9   <artifactId>commons-launcher-bootstrap</artifactId>
    10 10   <build>
    skipped 30 lines
  • ■ ■ ■ ■
    commons-launcher/commons-launcher-loader/pom.xml
    skipped 4 lines
    5 5   <parent>
    6 6   <groupId>io.onedev</groupId>
    7 7   <artifactId>commons-launcher</artifactId>
    8  - <version>2.0.5</version>
     8 + <version>2.0.6</version>
    9 9   </parent>
    10 10   <build>
    11 11   <plugins>
    skipped 45 lines
  • ■ ■ ■ ■
    commons-launcher/pom.xml
    skipped 3 lines
    4 4   <parent>
    5 5   <groupId>io.onedev</groupId>
    6 6   <artifactId>commons</artifactId>
    7  - <version>2.0.5</version>
     7 + <version>2.0.6</version>
    8 8   </parent>
    9 9   <artifactId>commons-launcher</artifactId>
    10 10   <packaging>pom</packaging>
    skipped 73 lines
  • ■ ■ ■ ■
    commons-utils/pom.xml
    skipped 4 lines
    5 5   <parent>
    6 6   <groupId>io.onedev</groupId>
    7 7   <artifactId>commons</artifactId>
    8  - <version>2.0.5</version>
     8 + <version>2.0.6</version>
    9 9   </parent>
    10 10   <artifactId>commons-utils</artifactId>
    11 11   <dependencies>
    skipped 91 lines
  • ■ ■ ■ ■ ■
    commons-utils/src/main/java/io/onedev/commons/utils/command/Commandline.java
    skipped 13 lines
    14 14  import java.util.concurrent.Executors;
    15 15  import java.util.concurrent.TimeoutException;
    16 16  import java.util.concurrent.atomic.AtomicBoolean;
     17 +import java.util.concurrent.atomic.AtomicLong;
    17 18   
    18 19  import javax.annotation.Nullable;
    19 20   
    skipped 216 lines
    236 237   throw new RuntimeException(e);
    237 238   }
    238 239   
    239  - ProcessStreamPumper streamPumper = new ProcessStreamPumper(process, stdout, stderr, stdin);
    240  -
    241 240   ExecutionResult result = new ExecutionResult(this);
    242 241   if (timeout != 0) {
     242 + AtomicLong lastActiveTime = new AtomicLong(System.currentTimeMillis());
     243 +
     244 + class OutputStreamWrapper extends OutputStream {
     245 +
     246 + private final OutputStream delegate;
     247 +
     248 + public OutputStreamWrapper(OutputStream delegate) {
     249 + this.delegate = delegate;
     250 + }
     251 +
     252 + @Override
     253 + public void flush() throws IOException {
     254 + if (delegate != null)
     255 + delegate.flush();
     256 + }
     257 + 
     258 + @Override
     259 + public void close() throws IOException {
     260 + if (delegate != null)
     261 + delegate.close();
     262 + }
     263 + 
     264 + @Override
     265 + public void write(int b) throws IOException {
     266 + lastActiveTime.set(System.currentTimeMillis());
     267 + if (delegate != null)
     268 + delegate.write(b);
     269 + }
     270 + 
     271 + @Override
     272 + public void write(byte[] b) throws IOException {
     273 + lastActiveTime.set(System.currentTimeMillis());
     274 + if (delegate != null)
     275 + delegate.write(b);
     276 + }
     277 + 
     278 + @Override
     279 + public void write(byte[] b, int off, int len) throws IOException {
     280 + lastActiveTime.set(System.currentTimeMillis());
     281 + if (delegate != null)
     282 + delegate.write(b, off, len);
     283 + }
     284 +
     285 + };
     286 +
     287 + ProcessStreamPumper streamPumper = new ProcessStreamPumper(process,
     288 + new OutputStreamWrapper(stdout), new OutputStreamWrapper(stderr), stdin);
     289 +
    243 290   Thread thread = Thread.currentThread();
    244 291   AtomicBoolean stoppedRef = new AtomicBoolean(false);
    245  - long time = System.currentTimeMillis();
    246 292   EXECUTOR_SERVICE.execute(new Runnable() {
    247 293   
    248 294   @Override
    249 295   public void run() {
    250 296   while (!stoppedRef.get()) {
    251  - if (System.currentTimeMillis() - time > timeout*1000L) {
     297 + if (System.currentTimeMillis() - lastActiveTime.get() > timeout*1000L) {
    252 298   thread.interrupt();
    253 299   break;
    254 300   } else {
    skipped 10 lines
    265 311   result.setReturnCode(process.waitFor());
    266 312   } catch (InterruptedException e) {
    267 313   processKiller.kill(process, executionId);
    268  - if (System.currentTimeMillis() - time > timeout*1000L)
     314 + if (System.currentTimeMillis() - lastActiveTime.get() > timeout*1000L)
    269 315   throw new RuntimeException(new TimeoutException());
    270 316   else
    271 317   throw new RuntimeException(e);
    skipped 2 lines
    274 320   streamPumper.waitFor();
    275 321   }
    276 322   } else {
     323 + ProcessStreamPumper streamPumper = new ProcessStreamPumper(process, stdout, stderr, stdin);
    277 324   try {
    278 325   result.setReturnCode(process.waitFor());
    279 326   } catch (InterruptedException e) {
    skipped 10 lines
  • ■ ■ ■ ■
    pom.xml
    skipped 8 lines
    9 9   <version>1.0.5</version>
    10 10   </parent>
    11 11   <artifactId>commons</artifactId>
    12  - <version>2.0.5</version>
     12 + <version>2.0.6</version>
    13 13   <packaging>pom</packaging>
    14 14   <modules>
    15 15   <module>commons-utils</module>
    skipped 291 lines
Please wait...
Page is in error, reload to recover