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
|
* @see com.rusefi.autoupdate.Autoupdate#VERSION
|
||||||
*/
|
*/
|
||||||
int CONSOLE_VERSION = 20240801;
|
int CONSOLE_VERSION = 20240806;
|
||||||
AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
||||||
|
|
||||||
static long classBuildTimeMillis() {
|
static long classBuildTimeMillis() {
|
||||||
|
|
|
@ -29,14 +29,14 @@ public class SimulatorHelper {
|
||||||
private static void startSimulator() {
|
private static void startSimulator() {
|
||||||
LinkManager.isSimulationMode = true;
|
LinkManager.isSimulationMode = true;
|
||||||
|
|
||||||
FileLog.MAIN.logLine("Executing " + BINARY);
|
FileLog.MAIN.logLine("Executing simulator " + BINARY);
|
||||||
THREAD_FACTORY.newThread(new Runnable() {
|
THREAD_FACTORY.newThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
FileLog.SIMULATOR_CONSOLE.start();
|
FileLog.SIMULATOR_CONSOLE.start();
|
||||||
process = Runtime.getRuntime().exec(BINARY);
|
process = Runtime.getRuntime().exec(BINARY);
|
||||||
FileLog.MAIN.logLine("Executing " + BINARY + "=" + process);
|
FileLog.MAIN.logLine("Executing simulator " + BINARY + "=" + process);
|
||||||
SimulatorExecHelper.dumpProcessOutput(process, new CountDownLatch(1));
|
SimulatorExecHelper.dumpProcessOutput(process, new CountDownLatch(1));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
|
|
|
@ -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);
|
File workingDir = new File(workingDirPath);
|
||||||
|
try {
|
||||||
return executeCommand(command, callbacks, output, error, workingDir);
|
return executeCommand(command, callbacks, output, error, workingDir);
|
||||||
|
} catch (ErrorExecutingCommand e) {
|
||||||
|
callbacks.logLine("ErrorExecutingCommand: " + e);
|
||||||
|
callbacks.error();
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static String executeCommand(String command, UpdateOperationCallbacks callbacks, StringBuffer output, StringBuffer error, File workingDir) {
|
public static String executeCommand(String command, UpdateOperationCallbacks callbacks, StringBuffer output, StringBuffer error, File workingDir) throws ErrorExecutingCommand {
|
||||||
callbacks.logLine("Executing " + command);
|
callbacks.logLine("Executing command=" + command);
|
||||||
try {
|
try {
|
||||||
Process p = Runtime.getRuntime().exec(command, null, workingDir);
|
Process p = Runtime.getRuntime().exec(command, null, workingDir);
|
||||||
startStreamThread(p, p.getInputStream(), output, callbacks);
|
startStreamThread(p, p.getInputStream(), output, callbacks);
|
||||||
startStreamThread(p, p.getErrorStream(), error, callbacks);
|
startStreamThread(p, p.getErrorStream(), error, callbacks);
|
||||||
p.waitFor(3, TimeUnit.MINUTES);
|
p.waitFor(3, TimeUnit.MINUTES);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
callbacks.logLine("IOError: " + e);
|
throw new ErrorExecutingCommand(e);
|
||||||
callbacks.error();
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
callbacks.logLine("WaitError: " + e);
|
callbacks.logLine("WaitError: " + e);
|
||||||
callbacks.error();
|
callbacks.error();
|
||||||
|
|
|
@ -13,7 +13,13 @@ public class MaintenanceUtil {
|
||||||
// long now = System.currentTimeMillis();
|
// long now = System.currentTimeMillis();
|
||||||
StringBuffer output = new StringBuffer();
|
StringBuffer output = new StringBuffer();
|
||||||
StringBuffer error = new StringBuffer();
|
StringBuffer error = new StringBuffer();
|
||||||
|
try {
|
||||||
ExecHelper.executeCommand(queryCommand, callbacks, output, error, null);
|
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(output.toString());
|
||||||
callbacks.logLine(error.toString());
|
callbacks.logLine(error.toString());
|
||||||
// long cost = System.currentTimeMillis() - now;
|
// long cost = System.currentTimeMillis() - now;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<configuration default="false" name="TriggerImage individual" type="Application" factoryName="Application">
|
<configuration default="false" name="TriggerImage individual" type="Application" factoryName="Application">
|
||||||
<option name="MAIN_CLASS_NAME" value="com.rusefi.trigger.TriggerImage" />
|
<option name="MAIN_CLASS_NAME" value="com.rusefi.trigger.TriggerImage" />
|
||||||
<module name="java_tools.trigger-ui.main" />
|
<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">
|
<extension name="coverage">
|
||||||
<pattern>
|
<pattern>
|
||||||
<option name="PATTERN" value="com.rusefi.trigger.*" />
|
<option name="PATTERN" value="com.rusefi.trigger.*" />
|
||||||
|
|
Loading…
Reference in New Issue