Class ProcessUtil
- java.lang.Object
-
- de.tracetronic.jenkins.plugins.ecutest.util.ProcessUtil
-
public final class ProcessUtil extends Object
Utility class providing process and system operations.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<String>
checkETProcesses(boolean kill)
Check the ecu.test processes and kills them if appropriate.static void
checkOS(Launcher launcher)
Checks the operating system of a launcher.static List<String>
checkTSProcess(boolean kill)
Check the Tool-Server processes and kills them if appropriate.static boolean
is64BitExecutable(String filePath)
From https://stackoverflow.com/a/35418180static boolean
is64BitJVM(Computer computer)
Checks whether the underlying JVM supports 64-bit architecture.
-
-
-
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/35418180Reads 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 occurredInterruptedException
- if the build gets interrupted
-
-