2018-09-14 02:57:39 +10:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								const cp = require('child_process');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								const utils = require('./lib/utils');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								const electronPath = utils.getAbsoluteElectronExec();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-29 01:17:00 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								const child = cp.spawn(electronPath, process.argv.slice(2), { stdio: 'inherit' });
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-14 02:57:39 +10:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								child.on('close', (code) => process.exit(code));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								const handleTerminationSignal = (signal) =>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  process.on(signal, () => {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (!child.killed) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      child.kill(signal);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  });
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								handleTerminationSignal('SIGINT');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								handleTerminationSignal('SIGTERM');
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-02 20:36:06 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								handleTerminationSignal('SIGUSR2');
							 |