fix: Improve Windows compatibility for paths and shell config
- Use os.tmpdir() instead of hardcoded /tmp for cross-platform temp files - Use os.homedir() with USERPROFILE fallback for Windows home directory - Disable forceZsh on Windows (zsh not available by default) 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -2,9 +2,14 @@ import { spawn } from "child_process"
|
||||
import { exec } from "child_process"
|
||||
import { promisify } from "util"
|
||||
import { existsSync } from "fs"
|
||||
import { homedir } from "os"
|
||||
|
||||
const DEFAULT_ZSH_PATHS = ["/bin/zsh", "/usr/bin/zsh", "/usr/local/bin/zsh"]
|
||||
|
||||
function getHomeDir(): string {
|
||||
return process.env.HOME || process.env.USERPROFILE || homedir()
|
||||
}
|
||||
|
||||
function findZshPath(customZshPath?: string): string | null {
|
||||
if (customZshPath && existsSync(customZshPath)) {
|
||||
return customZshPath
|
||||
@@ -39,7 +44,7 @@ export async function executeHookCommand(
|
||||
cwd: string,
|
||||
options?: ExecuteHookOptions
|
||||
): Promise<CommandResult> {
|
||||
const home = process.env.HOME ?? ""
|
||||
const home = getHomeDir()
|
||||
|
||||
let expandedCommand = command
|
||||
.replace(/^~(?=\/|$)/g, home)
|
||||
|
||||
Reference in New Issue
Block a user