Skip to content

Commit 38d0c5e

Browse files
committed
fix: clean up
Signed-off-by: Lessica <[email protected]>
1 parent ba64a00 commit 38d0c5e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

trollinstalld.mm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,19 @@ - (NSDictionary *)onRemoteInstallPackage:(NSString *)message userInfo:(NSDiction
110110
HBLogDebug(@TAG "Successfully spawned trollstorehelper with pid: %d", pid);
111111

112112
// Wait for the process to finish
113-
if (waitpid(pid, &status, 0) < 0) {
113+
int waitResult;
114+
while ((waitResult = waitpid(pid, &status, 0)) < 0) {
115+
if (errno == EINTR) {
116+
// Interrupted by signal, retry
117+
continue;
118+
}
114119
HBLogDebug(@TAG "Error waiting for trollstorehelper: %s", strerror(errno));
115120
return @{@"error" : [NSString stringWithFormat:@"Error waiting for process: %s", strerror(errno)]};
116121
}
117122

123+
// Clean up the package file after installation
124+
[[NSFileManager defaultManager] removeItemAtPath:packagePath error:nil];
125+
118126
if (!WIFEXITED(status)) {
119127
HBLogDebug(@TAG "trollstorehelper did not exit normally");
120128
return @{@"error" : @"Process did not exit normally"};

0 commit comments

Comments
 (0)