瀏覽代碼

Fixes #168 - missing process env

main
Eric Amodio 7 年之前
父節點
當前提交
8eeb0aa12b
共有 1 個檔案被更改,包括 3 行新增3 行删除
  1. +3
    -3
      src/git/git.ts

+ 3
- 3
src/git/git.ts 查看文件

@ -67,7 +67,7 @@ async function gitCommandCore(options: GitCommandOptions, ...args: any[]): Promi
const opts = { encoding: 'utf8', ...options };
const s = await spawnPromise(git.path, args, {
cwd: options.cwd,
env: options.env,
env: options.env || process.env,
encoding: (opts.encoding === 'utf8') ? 'utf8' : 'binary'
} as SpawnOptions);
@ -439,13 +439,13 @@ export class Git {
static status(repoPath: string, porcelainVersion: number = 1): Promise<string> {
const porcelain = porcelainVersion >= 2 ? `--porcelain=v${porcelainVersion}` : '--porcelain';
return gitCommand({ cwd: repoPath, env: { GIT_OPTIONAL_LOCKS: '0' } }, 'status', porcelain, '--branch', '-u');
return gitCommand({ cwd: repoPath, env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' } }, 'status', porcelain, '--branch', '-u');
}
static status_file(repoPath: string, fileName: string, porcelainVersion: number = 1): Promise<string> {
const [file, root] = Git.splitPath(fileName, repoPath);
const porcelain = porcelainVersion >= 2 ? `--porcelain=v${porcelainVersion}` : '--porcelain';
return gitCommand({ cwd: root, env: { GIT_OPTIONAL_LOCKS: '0' } }, 'status', porcelain, file);
return gitCommand({ cwd: root, env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' } }, 'status', porcelain, file);
}
}

Loading…
取消
儲存