Update mod.rs

This commit is contained in:
Gav Wood 2016-04-14 22:13:38 -07:00
parent b7798d3869
commit 99b8e28051

View File

@ -88,20 +88,18 @@ impl Hypervisor {
/// Does nothing when it is already started on module is inside the /// Does nothing when it is already started on module is inside the
/// main binary /// main binary
fn start_module(&self, module_id: IpcModuleId) { fn start_module(&self, module_id: IpcModuleId) {
Self::match_module(&module_id).map(|binary_id| Self::match_module(&module_id).map(|binary_id| {
{ let mut processes = self.processes.write().unwrap();
let mut processes = self.processes.write().unwrap(); {
{ if processes.get(binary_id).is_some() {
let process = processes.get(binary_id); // already started for another module
if process.is_some() { return;
// already started for another module
return;
}
} }
let child = Command::new(binary_id).spawn().unwrap_or_else( }
|e| panic!("Hypervisor cannot start binary: {}", e)); let child = Command::new(binary_id).spawn().unwrap_or_else(
processes.insert(binary_id, child); |e| panic!("Hypervisor cannot start binary: {}", e));
}); processes.insert(binary_id, child);
});
} }
/// Reports if all modules are checked in /// Reports if all modules are checked in