Attempt to fix hung process on windows
This commit is contained in:
parent
b10c2a5527
commit
6507d6678e
4 changed files with 14 additions and 9 deletions
|
@ -1,3 +1,3 @@
|
|||
class Consts {
|
||||
static const VERSION = "1.1.112524.1211";
|
||||
static const VERSION = "1.1.112524.1703";
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:servermanager/structs/discordHookHelper.dart';
|
||||
|
||||
import '../structs/mod.dart';
|
||||
import '../structs/settings.dart';
|
||||
|
|
|
@ -13,6 +13,11 @@ Future<bool> requiresWine() async {
|
|||
Future<void> runWine(String command, List<String> argx) async {
|
||||
bool requiredWine = await requiresWine();
|
||||
|
||||
if (Platform.isWindows) {
|
||||
await runDetachedWine(command, argx, Directory.current.path);
|
||||
return;
|
||||
}
|
||||
|
||||
Settings settings = Settings();
|
||||
Directory dir = Directory(settings.getWinePrefixPath());
|
||||
|
||||
|
@ -29,14 +34,15 @@ Future<void> runWine(String command, List<String> argx) async {
|
|||
args.addAll(argx);
|
||||
|
||||
ProcessResult? res;
|
||||
if (requiredWine)
|
||||
if (requiredWine) {
|
||||
res = await Process.run(
|
||||
"wine",
|
||||
args, // Run arbitrary command with arguments
|
||||
environment: env,
|
||||
);
|
||||
else
|
||||
} else {
|
||||
res = await Process.run("cmd", ["/C"] + args, environment: {});
|
||||
}
|
||||
|
||||
print('Exit code: ${res.exitCode}');
|
||||
print('stdout: ${res.stdout}');
|
||||
|
@ -97,18 +103,18 @@ Future<void> runDetachedWine(
|
|||
List<String> args = [command];
|
||||
args.addAll(argx);
|
||||
|
||||
if (requiredWine)
|
||||
if (requiredWine) {
|
||||
StateMachine.PROC = await Process.start(
|
||||
"wine", args, // Run arbitrary command with arguments
|
||||
environment: env,
|
||||
workingDirectory: workingDir,
|
||||
mode: ProcessStartMode.detachedWithStdio);
|
||||
else
|
||||
StateMachine.PROC = await Process.start(
|
||||
args[0], args.length > 1 ? args.sublist(1) : [],
|
||||
} else {
|
||||
StateMachine.PROC = await Process.start("cmd", ["/C"] + args,
|
||||
environment: {},
|
||||
workingDirectory: workingDir,
|
||||
mode: ProcessStartMode.detachedWithStdio);
|
||||
}
|
||||
|
||||
try {
|
||||
StateMachine.PROC!.stdout.forEach((line) {});
|
||||
|
|
|
@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
|||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.1.112524+1211
|
||||
version: 1.1.112524+1703
|
||||
|
||||
environment:
|
||||
sdk: ">=3.1.4 <4.0.0"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue