fix(desktop): print version before initializing the app (#15440)
This commit is contained in:
1 parent
c8d7d50a73
commit
e01e58916f
1 file changed
+11
@@ -8,6 +8,8 @@ for (const stream of [process.stdout, process.stderr]) {
|
||||
import * as NodeHttpClient from "@effect/platform-node/NodeHttpClient";
|
||||
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
// @effect-diagnostics-next-line nodeBuiltinImport:off - Version output must flush before Electron exits, without acquiring the runtime.
|
||||
import * as NodeFS from "node:fs";
|
||||
import * as NodeOS from "node:os";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
@@ -69,6 +71,15 @@ import * as DesktopWslBackend from "./wsl/DesktopWslBackend.ts";
|
||||
import * as DesktopWslEnvironment from "./wsl/DesktopWslEnvironment.ts";
|
||||
import * as DesktopWslServerTree from "./wsl/DesktopWslServerTree.ts";
|
||||
|
||||
if (process.argv.includes("--version")) {
|
||||
try {
|
||||
NodeFS.writeSync(process.stdout.fd, `${Electron.app.getVersion()}\n`);
|
||||
} catch (error) {
|
||||
if (!(error instanceof Error) || !("code" in error) || error.code !== "EPIPE") throw error;
|
||||
}
|
||||
Electron.app.exit(0);
|
||||
}
|
||||
|
||||
const desktopEnvironmentLayer = Layer.unwrap(
|
||||
Effect.gen(function* () {
|
||||
const metadata = yield* Effect.service(ElectronApp.ElectronApp).pipe(
|
||||
|
||||
Reference in new issue
Block a user