@@ -145,10 +145,19 @@ impl Dev {
145
145
}
146
146
}
147
147
148
+ let cargo_features = config
149
+ . lock ( )
150
+ . unwrap ( )
151
+ . as_ref ( )
152
+ . unwrap ( )
153
+ . build
154
+ . features
155
+ . clone ( ) ;
156
+
148
157
let ( child_wait_tx, child_wait_rx) = channel ( ) ;
149
158
let child_wait_rx = Arc :: new ( Mutex :: new ( child_wait_rx) ) ;
150
159
151
- process = self . start_app ( & runner, child_wait_rx. clone ( ) ) ;
160
+ process = self . start_app ( & runner, & cargo_features , child_wait_rx. clone ( ) ) ;
152
161
153
162
let ( tx, rx) = channel ( ) ;
154
163
@@ -191,22 +200,34 @@ impl Dev {
191
200
break ;
192
201
}
193
202
}
194
- process = self . start_app ( & runner, child_wait_rx. clone ( ) ) ;
203
+ process = self . start_app ( & runner, & cargo_features , child_wait_rx. clone ( ) ) ;
195
204
}
196
205
}
197
206
}
198
207
}
199
208
}
200
209
201
- fn start_app ( & self , runner : & str , child_wait_rx : Arc < Mutex < Receiver < ( ) > > > ) -> Arc < SharedChild > {
210
+ fn start_app (
211
+ & self ,
212
+ runner : & str ,
213
+ features : & Option < Vec < String > > ,
214
+ child_wait_rx : Arc < Mutex < Receiver < ( ) > > > ,
215
+ ) -> Arc < SharedChild > {
202
216
let mut command = Command :: new ( runner) ;
203
217
command. args ( & [ "run" , "--no-default-features" ] ) ;
218
+
204
219
if let Some ( target) = & self . target {
205
220
command. args ( & [ "--target" , target] ) ;
206
221
}
222
+
223
+ if let Some ( features) = features {
224
+ command. args ( & [ "--features" , & features. join ( "," ) ] ) ;
225
+ }
226
+
207
227
if !self . args . is_empty ( ) {
208
228
command. arg ( "--" ) . args ( & self . args ) ;
209
229
}
230
+
210
231
let child =
211
232
SharedChild :: spawn ( & mut command) . unwrap_or_else ( |_| panic ! ( "failed to run {}" , runner) ) ;
212
233
let child_arc = Arc :: new ( child) ;
0 commit comments