process: log the QEMU launch arguments

This commit is contained in:
osy
2023-07-14 01:19:56 -07:00
parent 1746bdbbca
commit ea4dccccdd
3 changed files with 19 additions and 9 deletions
+1
View File
@@ -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
View File
@@ -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
View File
@@ -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) {