2
0
Эх сурвалжийг харах

process: log the QEMU launch arguments

osy 2 жил өмнө
parent
commit
ea4dccccdd

+ 1 - 0
Services/UTMProcess.h

@@ -27,6 +27,7 @@ typedef int (*UTMProcessThreadEntry)(UTMProcess *self, int argc, const char * _N
 @property (nonatomic, readonly) BOOL hasRemoteProcess;
 @property (nonatomic, readonly) NSURL *libraryURL;
 @property (nonatomic) NSArray<NSString *> *argv;
+@property (nonatomic, readonly) NSString *arguments;
 @property (nonatomic, nullable) NSDictionary<NSString *, NSString *> *environment;
 @property (nonatomic) NSInteger status;
 @property (nonatomic) NSInteger fatal;

+ 13 - 9
Services/UTMProcess.m

@@ -95,6 +95,18 @@ static int defaultEntry(UTMProcess *self, int argc, const char *argv[], const ch
     return _connection != nil;
 }
 
+- (NSString *)arguments {
+    NSString *args = @"";
+    for (NSString *arg in _argv) {
+        if ([arg containsString:@" "]) {
+            args = [args stringByAppendingFormat:@" \"%@\"", arg];
+        } else {
+            args = [args stringByAppendingFormat:@" %@", arg];
+        }
+    }
+    return args;
+}
+
 #pragma mark - Construction
 
 - (instancetype)init {
@@ -149,15 +161,7 @@ static int defaultEntry(UTMProcess *self, int argc, const char *argv[], const ch
 }
 
 - (void)printArgv {
-    NSString *args = @"";
-    for (NSString *arg in _argv) {
-        if ([arg containsString:@" "]) {
-            args = [args stringByAppendingFormat:@" \"%@\"", arg];
-        } else {
-            args = [args stringByAppendingFormat:@" %@", arg];
-        }
-    }
-    UTMLog(@"Running: %@", args);
+    UTMLog(@"Running: %@", self.arguments);
 }
 
 - (BOOL)didLoadDylib:(void *)handle {

+ 5 - 0
Services/UTMQemuSystem.m

@@ -70,6 +70,11 @@ static int startQemu(UTMProcess *process, int argc, const char *argv[], const ch
     [self doesNotRecognizeSelector:_cmd];
 }
 
+- (void)setLogging:(QEMULogging *)logging {
+    _logging = logging;
+    [logging writeLine:[NSString stringWithFormat:@"Launching: qemu-system-%@%@\n", self.architecture, self.arguments]];
+}
+
 - (instancetype)initWithArguments:(NSArray<NSString *> *)arguments architecture:(nonnull NSString *)architecture {
     self = [super initWithArguments:arguments];
     if (self) {