@@ -72,7 +72,7 @@ bitflags! {
72
72
}
73
73
74
74
/// The status of a child process after calling [`wait`]/[`waitpid`].
75
- #[ derive( Debug , Clone , Copy ) ]
75
+ #[ derive( Clone , Copy ) ]
76
76
#[ repr( transparent) ]
77
77
pub struct WaitStatus ( i32 ) ;
78
78
@@ -91,31 +91,36 @@ impl WaitStatus {
91
91
92
92
/// Returns whether the process is currently stopped.
93
93
#[ inline]
94
+ #[ doc( alias = "WIFSTOPPED" ) ]
94
95
pub fn stopped ( self ) -> bool {
95
96
backend:: process:: wait:: WIFSTOPPED ( self . 0 )
96
97
}
97
98
98
99
/// Returns whether the process has exited normally.
99
100
#[ inline]
101
+ #[ doc( alias = "WIFEXITED" ) ]
100
102
pub fn exited ( self ) -> bool {
101
103
backend:: process:: wait:: WIFEXITED ( self . 0 )
102
104
}
103
105
104
106
/// Returns whether the process was terminated by a signal.
105
107
#[ inline]
108
+ #[ doc( alias = "WIFSIGNALED" ) ]
106
109
pub fn signaled ( self ) -> bool {
107
110
backend:: process:: wait:: WIFSIGNALED ( self . 0 )
108
111
}
109
112
110
113
/// Returns whether the process has continued from a job control stop.
111
114
#[ inline]
115
+ #[ doc( alias = "WIFCONTINUED" ) ]
112
116
pub fn continued ( self ) -> bool {
113
117
backend:: process:: wait:: WIFCONTINUED ( self . 0 )
114
118
}
115
119
116
120
/// Returns the number of the signal that stopped the process, if the
117
121
/// process was stopped by a signal.
118
122
#[ inline]
123
+ #[ doc( alias = "WSTOPSIG" ) ]
119
124
pub fn stopping_signal ( self ) -> Option < i32 > {
120
125
if self . stopped ( ) {
121
126
Some ( backend:: process:: wait:: WSTOPSIG ( self . 0 ) )
@@ -127,6 +132,7 @@ impl WaitStatus {
127
132
/// Returns the exit status number returned by the process, if it exited
128
133
/// normally.
129
134
#[ inline]
135
+ #[ doc( alias = "WEXITSTATUS" ) ]
130
136
pub fn exit_status ( self ) -> Option < i32 > {
131
137
if self . exited ( ) {
132
138
Some ( backend:: process:: wait:: WEXITSTATUS ( self . 0 ) )
@@ -138,6 +144,7 @@ impl WaitStatus {
138
144
/// Returns the number of the signal that terminated the process, if the
139
145
/// process was terminated by a signal.
140
146
#[ inline]
147
+ #[ doc( alias = "WTERMSIG" ) ]
141
148
pub fn terminating_signal ( self ) -> Option < i32 > {
142
149
if self . signaled ( ) {
143
150
Some ( backend:: process:: wait:: WTERMSIG ( self . 0 ) )
@@ -147,6 +154,26 @@ impl WaitStatus {
147
154
}
148
155
}
149
156
157
+ impl fmt:: Debug for WaitStatus {
158
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
159
+ let mut s = f. debug_struct ( "WaitStatus" ) ;
160
+ s. field ( "stopped" , & self . stopped ( ) ) ;
161
+ s. field ( "exited" , & self . exited ( ) ) ;
162
+ s. field ( "signaled" , & self . signaled ( ) ) ;
163
+ s. field ( "continued" , & self . continued ( ) ) ;
164
+ if let Some ( stopping_signal) = self . stopping_signal ( ) {
165
+ s. field ( "stopping_signal" , & stopping_signal) ;
166
+ }
167
+ if let Some ( exit_status) = self . exit_status ( ) {
168
+ s. field ( "exit_status" , & exit_status) ;
169
+ }
170
+ if let Some ( terminating_signal) = self . terminating_signal ( ) {
171
+ s. field ( "terminating_signal" , & terminating_signal) ;
172
+ }
173
+ s. finish ( )
174
+ }
175
+ }
176
+
150
177
/// The status of a process after calling [`waitid`].
151
178
#[ derive( Clone , Copy ) ]
152
179
#[ repr( transparent) ]
0 commit comments