mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix(cli): preserve invoked cwd for local launcher (#299)
This commit is contained in:
@@ -4,6 +4,7 @@ import { basename, dirname, isAbsolute, resolve } from 'node:path';
|
||||
|
||||
import type { WorktreeInfo } from '@/runner/worktree';
|
||||
import { logger } from '@/ui/logger';
|
||||
import { getInvokedCwd } from '@/utils/invokedCwd';
|
||||
|
||||
export function readWorktreeEnv(): WorktreeInfo | null {
|
||||
return readWorktreeFromEnv() ?? readWorktreeFromGit();
|
||||
@@ -39,7 +40,7 @@ function readWorktreeFromGit(): WorktreeInfo | null {
|
||||
let result: WorktreeInfo | null = null;
|
||||
|
||||
try {
|
||||
const cwd = process.cwd();
|
||||
const cwd = getInvokedCwd();
|
||||
const isInside = runGit(['rev-parse', '--is-inside-work-tree'], cwd);
|
||||
if (isInside !== 'true') {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user