Skip to content

Commit e548b63

Browse files
authored
Dont create fifo pipe unless there are swift-testing tests (#895)
We were creating the fifo pipe when doing a debugging run whith only XCTests, which is not necessary. Issue: #852
1 parent c40200b commit e548b63

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/TestExplorer/TestRunner.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,7 @@ export class TestRunner {
400400
// Run swift-testing first, then XCTest.
401401
// swift-testing being parallel by default should help these run faster.
402402
if (this.testArgs.hasSwiftTestingTests) {
403-
const fifoPipePath =
404-
process.platform === "win32"
405-
? `\\\\.\\pipe\\vscodemkfifo-${Date.now()}`
406-
: path.join(os.tmpdir(), `vscodemkfifo-${Date.now()}`);
403+
const fifoPipePath = this.generateFifoPipePath();
407404

408405
await TemporaryFolder.withNamedTemporaryFile(fifoPipePath, async () => {
409406
// macOS/Linux require us to create the named pipe before we use it.
@@ -689,19 +686,16 @@ export class TestRunner {
689686
}
690687

691688
const buildConfigs: Array<vscode.DebugConfiguration | undefined> = [];
692-
const fifoPipePath =
693-
process.platform === "win32"
694-
? `\\\\.\\pipe\\vscodemkfifo-${Date.now()}`
695-
: path.join(os.tmpdir(), `vscodemkfifo-${Date.now()}`);
689+
const fifoPipePath = this.generateFifoPipePath();
696690

697691
await TemporaryFolder.withNamedTemporaryFile(fifoPipePath, async () => {
698-
// macOS/Linux require us to create the named pipe before we use it.
699-
// Windows just lets us communicate by specifying a pipe path without any ceremony.
700-
if (process.platform !== "win32") {
701-
await execFile("mkfifo", [fifoPipePath], undefined, this.folderContext);
702-
}
703-
704692
if (this.testArgs.hasSwiftTestingTests) {
693+
// macOS/Linux require us to create the named pipe before we use it.
694+
// Windows just lets us communicate by specifying a pipe path without any ceremony.
695+
if (process.platform !== "win32") {
696+
await execFile("mkfifo", [fifoPipePath], undefined, this.folderContext);
697+
}
698+
705699
const swiftTestBuildConfig = TestingDebugConfigurationFactory.swiftTestingConfig(
706700
this.folderContext,
707701
fifoPipePath,
@@ -855,6 +849,12 @@ export class TestRunner {
855849
return new NonDarwinTestItemFinder(this.testArgs.testItems, this.folderContext);
856850
}
857851
}
852+
853+
private generateFifoPipePath(): string {
854+
return process.platform === "win32"
855+
? `\\\\.\\pipe\\vscodemkfifo-${Date.now()}`
856+
: path.join(os.tmpdir(), `vscodemkfifo-${Date.now()}`);
857+
}
858858
}
859859

860860
/** Interface defining how to find test items given a test id from XCTest output */

0 commit comments

Comments
 (0)