The only thing I can think of is the that something is being passed into the args. I also see we're using the throwInsteadOfExit arg. I'm also not sure what the second true parameter is used for when starting the appiumServer from the desktop app.
if (args) {
// a containing package passed in their own args, let's fill them out
// with defaults
args = Object.assign({}, getDefaultArgs(), args);
// if we have a containing package instead of running as a CLI process,
// that package might not appreciate us calling 'process.exit' willy-
// nilly, so give it the option to have us throw instead of exit
if (args.throwInsteadOfExit) {
throwInsteadOfExit = true;
// but remove it since it's not a real server arg per se
delete args.throwInsteadOfExit;
}
} else {
// otherwise parse from CLI
args = parser.parseArgs();
}
Here is the call to start the server from the desktop app:
function connectStartServer (win) {
ipcMain.on('start-server', async (event, args) => {
// clean up args object for appium log purposes (so it doesn't show in
// non-default args list
if (args.defaultCapabilities &&
Object.keys(args.defaultCapabilities).length === 0) {
delete args.defaultCapabilities;
}
args.logHandler = (level, msg) => {
batchedLogs.push({level, msg});
};
// make sure if the server barfs on startup, it throws an error rather
// than the typical behavior, which is process.exit o_O
args.throwInsteadOfExit = true;
// set up our log watcher
logWatcher = setInterval(() => {
if (batchedLogs.length) {
win.webContents.send('appium-log-line', batchedLogs);
batchedLogs = [];
}
}, LOG_SEND_INTERVAL_MS);
try {
// set up the appium server running in this thread
server = await **appiumServer(args, true);**
await settings.set('SERVER_ARGS', args);
win.webContents.send('appium-start-ok');
} catch (e) {
win.webContents.send('appium-start-error', e.message);
try {
await server.close();
} catch (ign) {}
clearInterval(logWatcher);
}
});
}