Ignore:
Timestamp:
2017-05-25T19:38:26+12:00 (7 years ago)
Author:
ak19
Message:

On Mac too, not just linux, the exit value of a kill pid cmd can be 1. This can mean the process was already terminated before the kill signal was sent or received. This is what happens when running full-rebuild.pl (but not full-import.pl) on a Mac, so that the process already cleanly terminated on interrupt and sending a TERM signal was unnecessary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/util/SafeProcess.java

    r31705 r31706  
    803803    }
    804804    return true;
    805     } else if(!Misc.isMac() && exitValue == 1) {
     805    } else if(exitValue == 1 && proc.getStdOutput().trim().equals("") && proc.getStdError().trim().equals("")) {
    806806    // https://stackoverflow.com/questions/28332888/return-value-of-kill
    807807    // "kill returns an exit code of 0 (true) if the process still existed it and was killed.
     
    810810    // the process and its subprocesses (don't need to call this method at all to terminate the processes: the processes
    811811    // aren't running when we get to this method)
    812     log("@@@ Sending termination signal returned exit value 1. On linux this happens when the process has already been terminated");
     812    log("@@@ Sending termination signal returned exit value 1. On unix this happens when the process has already been terminated.");
    813813    return true;
    814814    } else {
    815     log("@@@ Not able to successfully terminate process, got exitvalue " + exitValue);
     815    log("@@@ Not able to successfully terminate process. Got exitvalue: " + exitValue);
    816816    log("@@@ Got output: |" + proc.getStdOutput() + "|");
    817817    log("@@@ Got err output: |" + proc.getStdError() + "|");
Note: See TracChangeset for help on using the changeset viewer.