@vzn/vx 0.0.122 → 0.0.123

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": "@vzn/vx",
3
- "version": "0.0.122",
3
+ "version": "0.0.123",
4
4
  "description": "A fast, correct task runner and build cache for JavaScript monorepos.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,10 +17,10 @@
17
17
  "node": ">=18"
18
18
  },
19
19
  "optionalDependencies": {
20
- "@vzn/vx-linux-x64": "0.0.122",
21
- "@vzn/vx-linux-arm64": "0.0.122",
22
- "@vzn/vx-darwin-x64": "0.0.122",
23
- "@vzn/vx-darwin-arm64": "0.0.122"
20
+ "@vzn/vx-linux-x64": "0.0.123",
21
+ "@vzn/vx-linux-arm64": "0.0.123",
22
+ "@vzn/vx-darwin-x64": "0.0.123",
23
+ "@vzn/vx-darwin-arm64": "0.0.123"
24
24
  },
25
25
  "dependencies": {
26
26
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
@@ -1,4 +1,4 @@
1
- import { existsSync, readFileSync, statSync } from 'node:fs'
1
+ import { accessSync, constants as fsConstants, existsSync, readFileSync, statSync } from 'node:fs'
2
2
  import { constants as osConstants } from 'node:os'
3
3
  import path from 'node:path'
4
4
  import { execWord, exitSignal } from '../exec/index.js'
@@ -46,8 +46,12 @@ function fileVerdict(file: string): string {
46
46
  try {
47
47
  const st = statSync(file)
48
48
  if (st.isDirectory()) return 'is a directory'
49
- if ((st.mode & 0o111) === 0) return 'is not executable — chmod +x it'
50
- head = readFileSync(file, 'latin1').slice(0, 256)
49
+ // Ask the kernel: an execute bit for the group or others does not
50
+ // make a file this user owns executable to this user (root aside).
51
+ if (!executable(file)) return 'is not executable — chmod +x it'
52
+ // The kernel reads the #! line as bytes, and a path's bytes are its
53
+ // UTF-8: a latin1 read named a present non-ASCII interpreter missing.
54
+ head = readFileSync(file).subarray(0, 256).toString('utf8')
51
55
  } catch (err) {
52
56
  return `could not be read (${(err as Error).message})`
53
57
  }
@@ -115,3 +119,12 @@ const SIGNAL_WHY: Record<string, string> = {
115
119
  SIGSYS: 'a system call was refused — a seccomp filter, or the sandbox',
116
120
  SIGQUIT: 'the process was sent a quit (Ctrl-\\, or a kill -QUIT); a core dump may be beside it',
117
121
  }
122
+
123
+ function executable(file: string): boolean {
124
+ try {
125
+ accessSync(file, fsConstants.X_OK)
126
+ return true
127
+ } catch {
128
+ return false
129
+ }
130
+ }