Skip to content

Commit afbc415

Browse files
Merge pull request #7 from MtMath/fix-not-exit-process
fix: Process not exit Unity project
2 parents df7a2cd + bc4ba15 commit afbc415

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/modules/unity.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,15 @@ export const createUnityProject = async (unityPath: string, projectPath: string)
5757
}
5858

5959
export const openUnityProject = async (unityPath: string, projectPath: string) => {
60-
await execa(unityPath, ["-projectPath", projectPath], {
61-
stdio: "ignore",
60+
const subprocess = execa(unityPath, ["-projectPath", projectPath], {
6261
detached: true,
63-
cleanup: false,
62+
cleanup: false,
63+
stdio: "ignore",
6464
});
65+
66+
// Waits for a short period of time before deeming the command successful
67+
await new Promise((resolve) => setTimeout(resolve, 2000));
68+
69+
// Disassociate the Unity process from the script process
70+
subprocess.unref();
6571
}

0 commit comments

Comments
 (0)