* Add project Windows runtime selection * Fix project Windows runtime selection Co-authored-by: Orca <help@stably.ai> * fix: preserve WSL shell variables --------- Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com> Co-authored-by: Orca <help@stably.ai> Co-authored-by: Neil <neil@stably.ai>
57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
import { execFile } from 'child_process'
|
|
import { promisify } from 'util'
|
|
import { gitExecFileAsync, ghExecFileAsync, extractExecError } from '../git/runner'
|
|
|
|
// Why: legacy generic execFile wrapper - only used by callers that don't need
|
|
// WSL-aware routing. Repo-scoped callers should use the runner exports below.
|
|
export const execFileAsync = promisify(execFile)
|
|
export { ghExecFileAsync, gitExecFileAsync, extractExecError }
|
|
export { classifyGhError, classifyListIssuesError } from './gh-error-classification'
|
|
export {
|
|
_getOwnerRepoCacheSize,
|
|
_resetOwnerRepoCache,
|
|
getIssueOwnerRepo,
|
|
getOwnerRepo,
|
|
getOwnerRepoForRemote,
|
|
getRemoteUrlForRepo,
|
|
ghRepoExecOptions,
|
|
githubRepoContext,
|
|
parseGitHubOwnerRepo,
|
|
parseGitHubRemoteIdentity,
|
|
resolveIssueSource,
|
|
resolvePRRepositoryCandidates
|
|
} from './github-repository-identity'
|
|
export type {
|
|
GitHubRemoteIdentity,
|
|
GitHubRepoContext,
|
|
LocalGitExecOptions,
|
|
OwnerRepo,
|
|
PRRepositoryCandidates,
|
|
ResolvedIssueSource
|
|
} from './github-repository-identity'
|
|
|
|
const MAX_CONCURRENT = 4
|
|
let running = 0
|
|
const queue: (() => void)[] = []
|
|
|
|
export function acquire(): Promise<void> {
|
|
if (running < MAX_CONCURRENT) {
|
|
running += 1
|
|
return Promise.resolve()
|
|
}
|
|
return new Promise((resolve) =>
|
|
queue.push(() => {
|
|
running += 1
|
|
resolve()
|
|
})
|
|
)
|
|
}
|
|
|
|
export function release(): void {
|
|
running -= 1
|
|
const next = queue.shift()
|
|
if (next) {
|
|
next()
|
|
}
|
|
}
|