wmic not found on Windows 10 #6774
This commit is contained in:
parent
02c63dc1c8
commit
9be8012354
|
@ -9,7 +9,7 @@ public interface rusEFIVersion {
|
|||
/**
|
||||
* @see com.rusefi.autoupdate.Autoupdate#VERSION
|
||||
*/
|
||||
int CONSOLE_VERSION = 20240801;
|
||||
int CONSOLE_VERSION = 20240806;
|
||||
AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
||||
|
||||
static long classBuildTimeMillis() {
|
||||
|
|
|
@ -29,14 +29,14 @@ public class SimulatorHelper {
|
|||
private static void startSimulator() {
|
||||
LinkManager.isSimulationMode = true;
|
||||
|
||||
FileLog.MAIN.logLine("Executing " + BINARY);
|
||||
FileLog.MAIN.logLine("Executing simulator " + BINARY);
|
||||
THREAD_FACTORY.newThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
FileLog.SIMULATOR_CONSOLE.start();
|
||||
process = Runtime.getRuntime().exec(BINARY);
|
||||
FileLog.MAIN.logLine("Executing " + BINARY + "=" + process);
|
||||
FileLog.MAIN.logLine("Executing simulator " + BINARY + "=" + process);
|
||||
SimulatorExecHelper.dumpProcessOutput(process, new CountDownLatch(1));
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
|
@ -88,4 +88,4 @@ public class SimulatorHelper {
|
|||
if (process != null)
|
||||
process.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package com.rusefi.maintenance;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ErrorExecutingCommand extends Throwable {
|
||||
private final IOException e;
|
||||
|
||||
public ErrorExecutingCommand(IOException e) {
|
||||
this.e = e;
|
||||
}
|
||||
}
|
|
@ -70,20 +70,25 @@ public class ExecHelper {
|
|||
}
|
||||
|
||||
File workingDir = new File(workingDirPath);
|
||||
return executeCommand(command, callbacks, output, error, workingDir);
|
||||
try {
|
||||
return executeCommand(command, callbacks, output, error, workingDir);
|
||||
} catch (ErrorExecutingCommand e) {
|
||||
callbacks.logLine("ErrorExecutingCommand: " + e);
|
||||
callbacks.error();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String executeCommand(String command, UpdateOperationCallbacks callbacks, StringBuffer output, StringBuffer error, File workingDir) {
|
||||
callbacks.logLine("Executing " + command);
|
||||
public static String executeCommand(String command, UpdateOperationCallbacks callbacks, StringBuffer output, StringBuffer error, File workingDir) throws ErrorExecutingCommand {
|
||||
callbacks.logLine("Executing command=" + command);
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(command, null, workingDir);
|
||||
startStreamThread(p, p.getInputStream(), output, callbacks);
|
||||
startStreamThread(p, p.getErrorStream(), error, callbacks);
|
||||
p.waitFor(3, TimeUnit.MINUTES);
|
||||
} catch (IOException e) {
|
||||
callbacks.logLine("IOError: " + e);
|
||||
callbacks.error();
|
||||
throw new ErrorExecutingCommand(e);
|
||||
} catch (InterruptedException e) {
|
||||
callbacks.logLine("WaitError: " + e);
|
||||
callbacks.error();
|
||||
|
|
|
@ -13,7 +13,13 @@ public class MaintenanceUtil {
|
|||
// long now = System.currentTimeMillis();
|
||||
StringBuffer output = new StringBuffer();
|
||||
StringBuffer error = new StringBuffer();
|
||||
ExecHelper.executeCommand(queryCommand, callbacks, output, error, null);
|
||||
try {
|
||||
ExecHelper.executeCommand(queryCommand, callbacks, output, error, null);
|
||||
} catch (ErrorExecutingCommand e) {
|
||||
callbacks.logLine("IOError: " + e);
|
||||
// let's assume DFU is present just to give user more options
|
||||
return true;
|
||||
}
|
||||
callbacks.logLine(output.toString());
|
||||
callbacks.logLine(error.toString());
|
||||
// long cost = System.currentTimeMillis() - now;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<configuration default="false" name="TriggerImage individual" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME" value="com.rusefi.trigger.TriggerImage" />
|
||||
<module name="java_tools.trigger-ui.main" />
|
||||
<option name="PROGRAM_PARAMETERS" value="../unit_tests 21 10" />
|
||||
<option name="PROGRAM_PARAMETERS" value="../unit_tests 84 100" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.rusefi.trigger.*" />
|
||||
|
|
Loading…
Reference in New Issue