main: Load perf scripts as modules

The perf scripts that can be used to script the gnome-shell UI
for testing are sufficiently separate from the rest of the code
base to allow porting them to ESM modules before the rest of
the code base.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2812>
This commit is contained in:
Florian Müllner
2023-06-13 02:13:01 +02:00
parent dbc9ebc6ab
commit 5e93791708
7 changed files with 57 additions and 75 deletions

View File

@ -1,6 +1,6 @@
import {setConsoleLogDomain} from 'console';
import GLib from 'gi://GLib';
import {exit} from 'system';
import Gio from 'gi://Gio';
setConsoleLogDomain('GNOME Shell');
@ -11,12 +11,12 @@ imports.ui.environment.init();
imports._promiseNative.setMainLoopHook(() => {
// Queue starting the shell
GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
try {
imports.ui.main.start();
} catch (e) {
logError(e);
exit(1);
}
imports.ui.main.start().catch(e => {
const error = new GLib.Error(
Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED,
e.message);
global.context.terminate_with_error(error);
});
return GLib.SOURCE_REMOVE;
});