@oh-my-pi/pi-utils 9.2.2 → 9.2.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/procmgr.ts +7 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-utils",
3
- "version": "9.2.2",
3
+ "version": "9.2.3",
4
4
  "description": "Shared utilities for pi packages",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
package/src/procmgr.ts CHANGED
@@ -17,9 +17,9 @@ const TERM_SIGNAL = IS_WINDOWS ? undefined : "SIGTERM";
17
17
  /**
18
18
  * Check if a shell binary is executable.
19
19
  */
20
- async function isExecutable(path: string): Promise<boolean> {
20
+ function isExecutable(path: string): boolean {
21
21
  try {
22
- await fs.promises.access(path, fs.constants.X_OK);
22
+ fs.accessSync(path, fs.constants.X_OK);
23
23
  return true;
24
24
  } catch {
25
25
  return false;
@@ -90,14 +90,14 @@ function buildConfig(shell: string): ShellConfig {
90
90
  * 3. On Unix: $SHELL if bash/zsh, then fallback paths
91
91
  * 4. Fallback: sh
92
92
  */
93
- export async function getShellConfig(customShellPath?: string): Promise<ShellConfig> {
93
+ export function getShellConfig(customShellPath?: string): ShellConfig {
94
94
  if (cachedShellConfig) {
95
95
  return cachedShellConfig;
96
96
  }
97
97
 
98
98
  // 1. Check user-specified shell path
99
99
  if (customShellPath) {
100
- if (await Bun.file(customShellPath).exists()) {
100
+ if (fs.existsSync(customShellPath)) {
101
101
  cachedShellConfig = buildConfig(customShellPath);
102
102
  return cachedShellConfig;
103
103
  }
@@ -119,7 +119,7 @@ export async function getShellConfig(customShellPath?: string): Promise<ShellCon
119
119
  }
120
120
 
121
121
  for (const path of paths) {
122
- if (await Bun.file(path).exists()) {
122
+ if (fs.existsSync(path)) {
123
123
  cachedShellConfig = buildConfig(path);
124
124
  return cachedShellConfig;
125
125
  }
@@ -144,7 +144,7 @@ export async function getShellConfig(customShellPath?: string): Promise<ShellCon
144
144
  // Unix: prefer user's shell from $SHELL if it's bash/zsh and executable
145
145
  const userShell = process.env.SHELL;
146
146
  const isValidShell = userShell && (userShell.includes("bash") || userShell.includes("zsh"));
147
- if (isValidShell && (await isExecutable(userShell))) {
147
+ if (isValidShell && isExecutable(userShell)) {
148
148
  cachedShellConfig = buildConfig(userShell);
149
149
  return cachedShellConfig;
150
150
  }
@@ -157,7 +157,7 @@ export async function getShellConfig(customShellPath?: string): Promise<ShellCon
157
157
  for (const shellName of shellOrder) {
158
158
  for (const dir of fallbackPaths) {
159
159
  const shellPath = `${dir}/${shellName}`;
160
- if (await isExecutable(shellPath)) {
160
+ if (isExecutable(shellPath)) {
161
161
  cachedShellConfig = buildConfig(shellPath);
162
162
  return cachedShellConfig;
163
163
  }