Skip to content

[SR-10639] Connecting two Processes with Pipe crashes  #3349

Closed
@nikstar

Description

@nikstar
Previous ID SR-10639
Radar None
Original Reporter @nikstar
Type Bug
Status Resolved
Resolution Done
Environment

Ubuntu 18.04; Swift 5.0.1 release, same on swift-DEVELOPMENT-SNAPSHOT-2019-05-07-a-ubuntu18.04

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee @spevans
Priority Medium

md5: 1ad90002f690ee22118f79102bc6ecde

relates to:

  • SR-11699 Calling closeFile() on standardInput Pipe before calling Process.run() aborts with EBADF on Linux

Issue Description:

Following code crashes on Linux:

import Foundation 

let ls = Process() 
ls.executableURL = URL(fileURLWithPath: "/bin/ls")
let cat = Process()
cat.executableURL = URL(fileURLWithPath: "/bin/cat")

let pipe = Pipe() 
ls.standardOutput = pipe
cat.standardInput = pipe

try! ls.run()
try! cat.run()
cat.waitUntilExit()

Console output:

Fatal error: POSIX command failed with error: 9 – EBADF: file /home/buildnode/jenkins/workspace/oss-swift-package-linux-ubuntu-18_04/swift-corelibs-foundation/Foundation/Process.swift, line 977
 Illegal instruction (core dumped)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions