@@ -45,8 +45,8 @@ public struct StandardIOMessageConnection: MessageConnection {
45
45
/// directly to `stdin` and `stdout` as WASI doesn't support
46
46
/// `dup{,2}`.
47
47
public init ( ) throws {
48
- let inputFD = fileno ( _stdin )
49
- let outputFD = fileno ( _stdout )
48
+ let inputFD = fileno ( swift_syntax_stdin )
49
+ let outputFD = fileno ( swift_syntax_stdout )
50
50
self . init ( inputFileDescriptor: inputFD, outputFileDescriptor: outputFD)
51
51
}
52
52
#else
@@ -60,29 +60,29 @@ public struct StandardIOMessageConnection: MessageConnection {
60
60
public init ( ) throws {
61
61
// Duplicate the `stdin` file descriptor, which we will then use for
62
62
// receiving messages from the plugin host.
63
- let inputFD = dup ( fileno ( _stdin ) )
63
+ let inputFD = dup ( fileno ( swift_syntax_stdin ) )
64
64
guard inputFD >= 0 else {
65
- throw IOError . systemError ( function: " dup(fileno(stdin)) " , errno: _errno )
65
+ throw IOError . systemError ( function: " dup(fileno(stdin)) " , errno: swift_syntax_errno )
66
66
}
67
67
68
68
// Having duplicated the original standard-input descriptor, we close
69
69
// `stdin` so that attempts by the plugin to read console input (which
70
70
// are usually a mistake) return errors instead of blocking.
71
- guard close ( fileno ( _stdin ) ) >= 0 else {
72
- throw IOError . systemError ( function: " close(fileno(stdin)) " , errno: _errno )
71
+ guard close ( fileno ( swift_syntax_stdin ) ) >= 0 else {
72
+ throw IOError . systemError ( function: " close(fileno(stdin)) " , errno: swift_syntax_errno )
73
73
}
74
74
75
75
// Duplicate the `stdout` file descriptor, which we will then use for
76
76
// sending messages to the plugin host.
77
- let outputFD = dup ( fileno ( _stdout ) )
77
+ let outputFD = dup ( fileno ( swift_syntax_stdout ) )
78
78
guard outputFD >= 0 else {
79
- throw IOError . systemError ( function: " dup(fileno(stdout)) " , errno: _errno )
79
+ throw IOError . systemError ( function: " dup(fileno(stdout)) " , errno: swift_syntax_errno )
80
80
}
81
81
82
82
// Having duplicated the original standard-output descriptor, redirect
83
83
// `stdout` to `stderr` so that all free-form text output goes there.
84
- guard dup2 ( fileno ( _stderr ) , fileno ( _stdout ) ) >= 0 else {
85
- throw IOError . systemError ( function: " dup2(fileno(stderr), fileno(stdout)) " , errno: _errno )
84
+ guard dup2 ( fileno ( swift_syntax_stderr ) , fileno ( swift_syntax_stdout ) ) >= 0 else {
85
+ throw IOError . systemError ( function: " dup2(fileno(stderr), fileno(stdout)) " , errno: swift_syntax_errno )
86
86
}
87
87
88
88
#if canImport(ucrt)
@@ -101,7 +101,7 @@ public struct StandardIOMessageConnection: MessageConnection {
101
101
let endPtr = ptr. advanced ( by: buffer. count)
102
102
while ptr != endPtr {
103
103
switch write ( outputFileDescriptor, ptr, numericCast ( endPtr - ptr) ) {
104
- case - 1 : throw IOError . systemError ( function: " write(_:_:_:) " , errno: _errno )
104
+ case - 1 : throw IOError . systemError ( function: " write(_:_:_:) " , errno: swift_syntax_errno )
105
105
case 0 : throw IOError . systemError ( function: " write " , errno: 0 ) /* unreachable */
106
106
case let n: ptr += Int ( n)
107
107
}
@@ -116,7 +116,7 @@ public struct StandardIOMessageConnection: MessageConnection {
116
116
let endPtr = ptr. advanced ( by: buffer. count)
117
117
while ptr != endPtr {
118
118
switch read ( inputFileDescriptor, ptr, numericCast ( endPtr - ptr) ) {
119
- case - 1 : throw IOError . systemError ( function: " read(_:_:_:) " , errno: _errno )
119
+ case - 1 : throw IOError . systemError ( function: " read(_:_:_:) " , errno: swift_syntax_errno )
120
120
case 0 : throw IOError . readReachedEndOfInput
121
121
case let n: ptr += Int ( n)
122
122
}
0 commit comments