Files
steipete--codexbar/TestsLinux/ShellCommandSessionLinuxTests.swift
T
2026-07-13 12:22:33 +08:00

23 lines
751 B
Swift

import Foundation
import Testing
@testable import CodexBarCore
#if os(Linux)
@Suite(.serialized)
struct ShellCommandSessionLinuxTests {
@Test
func `shell probe launches as a detached session leader`() throws {
let output = ShellCommandLocator.test_runShellCommand(
shell: "/bin/sh",
arguments: ["-c", "printf '%s ' \"$$\"; ps -o sid= -p \"$$\""],
timeout: 5)
let text = try #require(output.flatMap { String(data: $0, encoding: .utf8) })
let identifiers = text.split(whereSeparator: \.isWhitespace).compactMap { Int32($0) }
#expect(identifiers.count == 2)
guard identifiers.count == 2 else { return }
#expect(identifiers[0] == identifiers[1])
}
}
#endif