Skip to content

Commit f26db68

Browse files
rework mac editor spawn
1 parent 42e6d41 commit f26db68

1 file changed

Lines changed: 20 additions & 11 deletions

File tree

src/unity-editor.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,18 +214,27 @@ export class UnityEditor {
214214
} else {
215215
if (process.platform === 'darwin' && this.version.architecture === 'X86_64' && process.arch === 'arm64') {
216216
// Force the Unity Editor to run under Rosetta 2 on Apple Silicon Macs if the editor is x86_64
217-
command.args.unshift('arch', '-x86_64');
217+
command.args.unshift('-x86_64', this.editorPath);
218+
unityProcess = spawn(
219+
'arch',
220+
command.args, {
221+
stdio: ['ignore', 'ignore', 'ignore'],
222+
env: {
223+
...process.env,
224+
UNITY_THISISABUILDMACHINE: '1'
225+
}
226+
});
227+
} else {
228+
unityProcess = spawn(
229+
this.editorPath,
230+
command.args, {
231+
stdio: ['ignore', 'ignore', 'ignore'],
232+
env: {
233+
...process.env,
234+
UNITY_THISISABUILDMACHINE: '1'
235+
}
236+
});
218237
}
219-
220-
unityProcess = spawn(
221-
this.editorPath,
222-
command.args, {
223-
stdio: ['ignore', 'ignore', 'ignore'],
224-
env: {
225-
...process.env,
226-
UNITY_THISISABUILDMACHINE: '1'
227-
}
228-
});
229238
}
230239

231240
if (!unityProcess?.pid) {

0 commit comments

Comments
 (0)