• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive-studio / 24881971811

24 Apr 2026 09:16AM UTC coverage: 66.637% (+0.2%) from 66.481%
24881971811

push

github

web-flow
fix(main): enhance PATH when spawning thv so macOS credential helpers resolve (#2100)

* refactor(main): extract createEnhancedPath helper into shared util

* fix(main): enhance PATH when spawning thv so macOS credential helpers resolve

* refactor(main): address PR feedback on enhanced-path helper

3867 of 6317 branches covered (61.22%)

16 of 17 new or added lines in 1 file covered. (94.12%)

1 existing line in 1 file now uncovered.

5970 of 8959 relevant lines covered (66.64%)

124.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/main/src/container-engine.ts
1
import { exec } from 'node:child_process'
×
2
import { promisify } from 'node:util'
3
import { platform } from 'node:os'
4
import log from './logger'
5
import { createEnhancedPath } from './utils/enhanced-path'
6

7
const execAsync = promisify(exec)
×
8

9
interface ContainerEngineStatus {
10
  docker: boolean
11
  podman: boolean
12
  available: boolean
13
}
14

UNCOV
15
const tryCommand = async (command: string): Promise<boolean> => {
×
16
  try {
×
17
    await execAsync(command)
×
18
    return true
×
19
  } catch {
20
    try {
×
21
      await execAsync(command, {
×
22
        env: { ...process.env, PATH: createEnhancedPath() },
23
      })
24
      return true
×
25
    } catch {
26
      return false
×
27
    }
28
  }
29
}
30

31
const getCommandName = (base: string): string =>
×
32
  platform() === 'win32' ? `${base}.exe` : base
×
33

34
const checkDocker = (): Promise<boolean> =>
×
35
  tryCommand(`${getCommandName('docker')} ps`)
×
36

37
const checkPodman = (): Promise<boolean> =>
×
38
  tryCommand(`${getCommandName('podman')} ps`)
×
39

40
const createStatus = (
×
41
  docker: boolean,
42
  podman: boolean
43
): ContainerEngineStatus => ({
×
44
  docker,
45
  podman,
46
  available: docker || podman,
×
47
})
48

49
export const checkContainerEngine =
50
  async (): Promise<ContainerEngineStatus> => {
×
51
    const [docker, podman] = await Promise.allSettled([
×
52
      checkDocker(),
53
      checkPodman(),
54
    ]).then((results) =>
55
      results.map((result) => {
×
56
        if (result.status === 'rejected') return false
×
57
        return result.value
×
58
      })
59
    )
60

61
    const status = createStatus(!!docker, !!podman)
×
62

63
    if (!status.available) {
×
64
      log.warn('No container engines detected')
×
65
    }
66

67
    return status
×
68
  }
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc