Skip to content

Commit 7c67278

Browse files
committed
Restructure building matlab launch args
1 parent 0c6a689 commit 7c67278

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

src/lifecycle/MatlabLifecycleManager.ts

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -404,32 +404,26 @@ class MatlabProcess {
404404
command = matlabPath.includes(' ') ? `"${matlabPath}"` : matlabPath
405405
}
406406

407-
const args: string[] = []
408-
409-
const argsFromSettings = ConfigurationManager.getArgument(Argument.MatlabLaunchCommandArguments) ?? null
410-
if (argsFromSettings != null) {
411-
args.push(argsFromSettings)
412-
}
413-
414-
args.push('-nosplash')
407+
const args = [
408+
'-nosplash',
409+
'-useStartupFolderPref', // Startup folder flag
410+
'-memmgr', 'release', // Memory manager
411+
'-logFile', path.join(Logger.logDir, 'matlabls.log'), // Log file
412+
'-r', `"addpath(fullfile('${__dirname}', '..', 'matlab')); initmatlabls('${outFile}')"` // Startup command
413+
]
415414

416415
if (os.platform() === 'win32') {
417416
args.push('-wait')
418-
}
419-
420-
args.push('-useStartupFolderPref') // Startup folder flag
421-
args.push('-memmgr', 'release') // Memory manager
422-
args.push('-logfile', path.join(Logger.logDir, 'matlabls.log')) // Log file
423-
args.push('-r', `"addpath(fullfile('${__dirname}', '..', 'matlab')); initmatlabls('${outFile}')"`) // Startup command
424-
425-
// Desktop mode
426-
if (os.platform() === 'win32') {
427-
// Workaround for Windows until a better solution is implemented
428-
args.push('-noDisplayDesktop')
417+
args.push('-noDisplayDesktop') // Workaround for '-nodesktop' on Windows until a better solution is implemented
429418
} else {
430419
args.push('-nodesktop')
431420
}
432421

422+
const argsFromSettings = ConfigurationManager.getArgument(Argument.MatlabLaunchCommandArguments) ?? null
423+
if (argsFromSettings != null) {
424+
args.push(argsFromSettings)
425+
}
426+
433427
return {
434428
command,
435429
args

0 commit comments

Comments
 (0)