Commit 00c6134e authored by Joaquim Rocha's avatar Joaquim Rocha
Browse files

app: Spawn Headlamp server always detached and without shell

The way we were spawning the Headlamp server was different depending
on the platform and this led to issues where the server would be left
running after the app was quit.
This patch attempts to use a consistent set of options across
different platforms for launching the server.
parent 0700f6b5
xterm-windows-mode action-button-improvements add-cluster-to-notification-area add-direct-c-o-c add-fullscreen-to-editor add-labs add-msi-installer add-notification-page add-ports-to-pods add-proxy-endpoint add_manual_trigger_docker_action allow-to-build-without-checking-for-updates app-menus apply-multiple-resources autoscalers_resource_quota backend-dependencies bump-chocolatey-0.13.0 center-cluster-chooser chart-0.10.1 choco-bump-0.12.1 cluster_chooser codegen config_from_env de-de dep-updates2 dependabot/npm_and_yarn/app/electron-15.5.5 dependabot/npm_and_yarn/frontend/d3-color-and-recharts-3.1.0 dependabot/npm_and_yarn/frontend/deep-object-diff-1.1.9 dependabot/npm_and_yarn/frontend/loader-utils-1.4.2 dependabot/npm_and_yarn/frontend/terser-4.8.1 dependabot/npm_and_yarn/plugins/examples/app-menus/terser-5.14.2 dependabot/npm_and_yarn/plugins/examples/change-logo/glob-parent-and-kinvolk/headlamp-plugin-5.1.2 dependabot/npm_and_yarn/plugins/examples/change-logo/terser-5.14.2 dependabot/npm_and_yarn/plugins/examples/cluster-chooser/glob-parent-and-kinvolk/headlamp-plugin-5.1.2 dependabot/npm_and_yarn/plugins/examples/cluster-chooser/terser-5.14.2 dependabot/npm_and_yarn/plugins/examples/dynamic-clusters/glob-parent-and-kinvolk/headlamp-plugin-5.1.2 dependabot/npm_and_yarn/plugins/examples/dynamic-clusters/terser-5.14.2 dependabot/npm_and_yarn/plugins/examples/sidebar/terser-5.14.2 dependabot/npm_and_yarn/plugins/headlamp-plugin/terser-5.14.2 docker_desktop_ext docs-allow-to-build-without-checking-for-updates dont-use-a-one-click-installer-on-windows dont-wrap-header-cells e2e-container e2e-login e2e-playwright endpoints errcb-fix event-sorting example-fixes export-charts export-resource-chart-and-lib fetch-pods-by-labels fix-applying-ingresses fix-cluster-chooser fix-crash-in-label-selector fix-default-page-rows fix-filter-when-items-are-numbers fix-issue-in-page-grid-children-type fix-navigating-during-delete-op fix-release-note-stuck-issue fix-simple-table fix-table-filter fix_manual_trigger_gh_action fr-fr fullscreen_dialog gh_action_automate_pr go-back-through-location-stack handle-custom-auth-desktop headlamp-plugin-0.5.1-b headlamp-plugin-0.5.2-b headlamp-plugin-upgrade headlamp-upgrade-audit helm-fixes helm-typo-docs-fix hide-appbar improve-app-menus improve-pod-matcher improve-pod-status inno-setup jrocha/wip/show-build-version localefix log-viewer-scroll-fix mui-v5-upgrade namespaces-filter new-k8s-secret no-cluster-no-auth-required optimize-use-get persist-url-params plugin-docs plugin-error-handling plugin-source plugin-tests-in-js port-forwarding push-asset rc-0.10.0 rc-0.10.1 rc-0.11.0 rc-0.11.1 rc-0.12.0 rc-0.12.1 rc-0.13.0 refresh_token remove-plugin-video render-logs-using-xterm resource-class-issue resources-json role_bind_info scaling-ui search-involved-object-type-events-table set-default-namespace shorter-resource-age show-build-version show-dialog-if-release-fetch-failed sidebarroutefilter simple-table-details-from-url simplify-testing test-cleanup update-examples-052 update-release-draft update-signing-email upgrade-new-things use-fixed-date-on-tests wait-for-plugins width-cosmetic-fixes windows-testing v0.13.0 v0.12.1 v0.12.0 v0.11.1 v0.11.0 v0.10.1 v0.10.0 headlamp-plugin-0.5.3 headlamp-plugin-0.5.2 headlamp-plugin-0.5.1 headlamp-plugin-0.5.0 headlamp-plugin-0.4.9 headlamp-helm-0.8.0 headlamp-helm-0.7.0 headlamp-helm-0.6.0 headlamp-helm-0.5.0 headlamp-helm-0.4.0
No related merge requests found
Showing with 6 additions and 6 deletions
+6 -6
......@@ -39,12 +39,6 @@ function startServer(flags: string[] = []): ChildProcessWithoutNullStreams {
? path.resolve('../backend/headlamp-server')
: path.join(process.resourcesPath, './headlamp-server');
const options = { shell: true, detached: false };
if (process.platform !== 'win32' && !isDev) {
// This makes the child processes a separate group, for easier killing.
options.detached = true;
}
let serverArgs = [];
if (!!args.kubeconfig) {
serverArgs = serverArgs.concat(['--kubeconfig', args.kubeconfig]);
......@@ -63,6 +57,12 @@ function startServer(flags: string[] = []): ChildProcessWithoutNullStreams {
serverArgs = serverArgs.concat(flags);
console.log('arguments passed to backend server', serverArgs);
// We run detached but not in shell, otherwise it's hard to make sure the
// server process gets killed. When changing these options, please make sure
// to test quitting the app in the different platforms and making sure the
// server process has been correctly quit.
const options = { detached: true };
return spawn(serverFilePath, serverArgs, options);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment