@centralu/host-linux-x64 0.1.0-beta.25 → 0.1.0-beta.26

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.
@@ -11,7 +11,7 @@ import { spawnSync } from 'node:child_process'
11
11
  import { createHash, randomBytes } from 'node:crypto'
12
12
  import { chmodSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs'
13
13
  import { homedir } from 'node:os'
14
- import { basename, join } from 'node:path'
14
+ import { basename, join, win32 } from 'node:path'
15
15
  import { pathToFileURL } from 'node:url'
16
16
 
17
17
  const WORD = /^[0-9A-Za-z][0-9A-Za-z.+-]{0,63}$/
@@ -176,9 +176,15 @@ function alive(pid) {
176
176
  }
177
177
  }
178
178
 
179
- /** The system's tar. On Windows the one in System32 (bsdtar): a GNU tar on PATH reads `C:` as a host */
180
- function tarProgram() {
181
- return process.platform === 'win32' ? join(process.env.SystemRoot || 'C:\\Windows', 'System32', 'tar.exe') : 'tar'
179
+ /**
180
+ * The system's tar. On Windows the one in System32 (bsdtar): a GNU tar on PATH reads `C:` as a host. Named by its whole
181
+ * path: a `SystemRoot` that is not one from a drive's root is not used (the host's `systemTool` rule, which this script
182
+ * cannot import), since Windows looks a relative program path up in the working directory first (#428).
183
+ */
184
+ export function tarProgram(platform = process.platform, env = process.env) {
185
+ if (platform !== 'win32') return 'tar'
186
+ const root = /^[A-Za-z]:[\\/]/.test(env.SystemRoot ?? '') ? env.SystemRoot : 'C:\\Windows'
187
+ return win32.join(root, 'System32', 'tar.exe')
182
188
  }
183
189
 
184
190
  /** The tarball's bytes, refused unless their sha512 is the integrity the hub read from the signed metadata */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centralu/host-linux-x64",
3
- "version": "0.1.0-beta.25",
3
+ "version": "0.1.0-beta.26",
4
4
  "description": "Centralu's host without the window, for Linux on x86-64: what a hub installs on a linked machine",
5
5
  "license": "MIT",
6
6
  "author": "ijun17",