@lvce-editor/shared-process 0.14.12 → 0.14.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/shared-process",
3
- "version": "0.14.12",
3
+ "version": "0.14.14",
4
4
  "description": "Utility package for @lvce-editor/server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -17,9 +17,9 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@babel/code-frame": "^7.21.4",
20
- "@lvce-editor/extension-host": "0.14.12",
21
- "@lvce-editor/extension-host-helper-process": "0.14.12",
22
- "@lvce-editor/pty-host": "0.14.12",
20
+ "@lvce-editor/extension-host": "0.14.14",
21
+ "@lvce-editor/extension-host-helper-process": "0.14.14",
22
+ "@lvce-editor/pty-host": "0.14.14",
23
23
  "debug": "^4.3.4",
24
24
  "execa": "^7.1.1",
25
25
  "exit-hook": "^3.2.0",
@@ -1,4 +1,3 @@
1
- import { spawn } from 'node:child_process'
2
1
  import { rename } from 'node:fs/promises'
3
2
  import { tmpdir } from 'node:os'
4
3
  import { join } from 'node:path'
@@ -10,6 +9,7 @@ import * as GetAppImagePath from '../GetAppImagePath/GetAppImagePath.js'
10
9
  import * as GetLatestReleaseVersion from '../GetLatestReleaseVersion/GetLatestReleaseVersion.js'
11
10
  import * as MakeExecutable from '../MakeExecutable/MakeExecutable.js'
12
11
  import * as Platform from '../Platform/Platform.js'
12
+ import * as Restart from '../Restart/Restart.js'
13
13
  import { VError } from '../VError/VError.js'
14
14
 
15
15
  const getOutfilePath = (version) => {
@@ -56,11 +56,6 @@ const installNewAppImage = async (currentAppImageFile, downloadPath) => {
56
56
  }
57
57
  }
58
58
 
59
- const restart = (downloadPath) => {
60
- // TODO handle errors
61
- spawn(downloadPath, { stdio: 'inherit' })
62
- }
63
-
64
59
  export const installAndRestart = async (downloadPath) => {
65
60
  try {
66
61
  Assert.string(downloadPath)
@@ -70,7 +65,7 @@ export const installAndRestart = async (downloadPath) => {
70
65
  }
71
66
  await MakeExecutable.makeExecutable(downloadPath)
72
67
  const installedPath = await installNewAppImage(currentAppImageFile, downloadPath)
73
- await restart(installedPath)
68
+ await Restart.restart(installedPath)
74
69
  } catch (error) {
75
70
  // @ts-ignore
76
71
  throw new VError(error, `Failed to install AppImage update`)
@@ -0,0 +1,11 @@
1
+ import { spawn } from 'node:child_process'
2
+
3
+ export const restart = (downloadPath) => {
4
+ const { ELECTRON_RUN_AS_NODE, ...env } = process.env
5
+ // TODO handle errors
6
+ const childProcess = spawn(downloadPath, {
7
+ stdio: 'inherit',
8
+ env,
9
+ })
10
+ childProcess.unref()
11
+ }