Class ProcessUtil


  • public final class ProcessUtil
    extends Object
    Utility class providing process and system operations.
    • Method Detail

      • checkETProcesses

        public static List<String> checkETProcesses​(boolean kill)
        Check the ecu.test processes and kills them if appropriate.
        Parameters:
        kill - specifies whether to task-kill the running processes
        Returns:
        the list of found or killed processes
      • checkTSProcess

        public static List<String> checkTSProcess​(boolean kill)
        Check the Tool-Server processes and kills them if appropriate.
        Parameters:
        kill - specifies whether to task-kill the running processes
        Returns:
        the list of found or killed processes
      • checkOS

        public static void checkOS​(Launcher launcher)
                            throws ETPluginException
        Checks the operating system of a launcher.

        Most of the builders and publishers implemented by this plugin require to run on Windows.

        Parameters:
        launcher - the launcher
        Throws:
        ETPluginException - if Unix-based launcher
      • is64BitExecutable

        public static boolean is64BitExecutable​(String filePath)
                                         throws IOException
        From https://stackoverflow.com/a/35418180

        Reads the .exe file to find headers that tell us if the file is 32 or 64 bit.

        Note: Assumes byte pattern 0x50, 0x45, 0x00, 0x00 just before the byte that tells us the architecture.

        Parameters:
        filePath - fully qualified .exe file path.
        Returns:
        true if the file is a 64-bit executable, false otherwise.
        Throws:
        IOException - if there is a problem reading the file or the file does not end in .exe.
      • is64BitJVM

        public static boolean is64BitJVM​(Computer computer)
                                  throws IOException,
                                         InterruptedException
        Checks whether the underlying JVM supports 64-bit architecture.
        Parameters:
        computer - the computer
        Returns:
        true 64-bit architecture is supported, false otherwise.
        Throws:
        IOException - signals that an I/O exception has occurred
        InterruptedException - if the build gets interrupted