Repository navigation
fix(desktop): relaunch on Linux without setting no_new_privs #35173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
TonybynMp4
wants to merge
7
commits into
pingdotgg:main
from
TonybynMp4:fix/desktop-deb-relaunch-no-new-privs
+543
−12
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
996f93a
fix(desktop): relaunch on Linux without setting no_new_privs
TonybynMp4 c17bdd9
fix(desktop): avoid relaunch after a failed deb update
juliusmarminge 5f3e42d
test(desktop): simplify Linux relaunch coverage
juliusmarminge 712a9cc
test(desktop): remove unused updater stub branch
juliusmarminge 792d072
test(desktop): type the installed DebUpdater harness explicitly
TonybynMp4 9f0d8c3
fix(desktop): relaunch the AppImage itself on Linux
TonybynMp4 fea52e5
test(desktop): adapt updater test mocks to the AppImage relaunch change
TonybynMp4 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
apps/desktop/src/electron/ElectronUpdater.installError.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import { assert, describe, it } from "@effect/vitest"; | ||
| import * as Effect from "effect/Effect"; | ||
| import * as Cause from "effect/Cause"; | ||
| import { vi } from "vite-plus/test"; | ||
|
|
||
| const { installed } = vi.hoisted(() => ({ | ||
| installed: { updater: undefined as typeof import("electron-updater").autoUpdater | undefined }, | ||
| })); | ||
|
|
||
| vi.mock("electron-updater", () => ({ | ||
| AppImageUpdater: vi.fn(), | ||
| get autoUpdater() { | ||
| return installed.updater; | ||
| }, | ||
| })); | ||
|
|
||
| import * as ElectronUpdater from "./ElectronUpdater.ts"; | ||
| import { makeInstalledDebUpdater } from "../updates/updatesTestHarness.ts"; | ||
|
|
||
| describe("ElectronUpdater", () => { | ||
| it.effect( | ||
| "rejects an install error emitted by the installed DebUpdater and removes its listener", | ||
| () => | ||
| Effect.gen(function* () { | ||
| const cause = new Error("pkexec exited with code 126: authentication cancelled"); | ||
| const native = yield* Effect.promise(() => makeInstalledDebUpdater(cause)); | ||
| installed.updater = native.updater; | ||
| try { | ||
| const updater = yield* ElectronUpdater.ElectronUpdater; | ||
| const listenersBefore = native.updater.listenerCount("error"); | ||
| const exit = yield* updater | ||
| .quitAndInstall({ isSilent: true, isForceRunAfter: false }) | ||
| .pipe(Effect.exit); | ||
| assert.equal( | ||
| exit._tag, | ||
| "Failure", | ||
| "the emitted installer error must fail the service call", | ||
| ); | ||
| if (exit._tag === "Success") return; | ||
| const error = Cause.squash(exit.cause); | ||
| assert.instanceOf(error, ElectronUpdater.ElectronUpdaterQuitAndInstallError); | ||
| assert.strictEqual(error.cause, cause); | ||
| assert.deepEqual(native.steps, ["install"]); | ||
| assert.equal(native.updater.listenerCount("error"), listenersBefore); | ||
| } finally { | ||
| installed.updater = undefined; | ||
| native.restore(); | ||
| } | ||
| }).pipe(Effect.provide(ElectronUpdater.layer)), | ||
| ); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only mirrors a mock call for the unchanged non-Linux path. Could you delete this test?
Posted via Macroscope — Test Signal