pnpm devでCtrl+Cで終了させてもプロセスが完全に殺せないのを修正 (#10914)
This commit is contained in:
		
							parent
							
								
									a80003cde5
								
							
						
					
					
						commit
						7cbd852fe5
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
					@ -44,11 +44,17 @@ const fs = require('fs');
 | 
				
			||||||
			if (!stat) throw new Error('not exist yet');
 | 
								if (!stat) throw new Error('not exist yet');
 | 
				
			||||||
			if (stat.size === 0) throw new Error('not built yet');
 | 
								if (stat.size === 0) throw new Error('not built yet');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			await execa('pnpm', ['start'], {
 | 
								const subprocess = await execa('pnpm', ['start'], {
 | 
				
			||||||
				cwd: __dirname + '/../',
 | 
									cwd: __dirname + '/../',
 | 
				
			||||||
				stdout: process.stdout,
 | 
									stdout: process.stdout,
 | 
				
			||||||
				stderr: process.stderr,
 | 
									stderr: process.stderr,
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// なぜかworkerだけが終了してmasterが残るのでその対策
 | 
				
			||||||
 | 
								process.on('SIGINT', () => {
 | 
				
			||||||
 | 
									subprocess.kill('SIGINT');
 | 
				
			||||||
 | 
									process.exit(0);
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
		} catch (e) {
 | 
							} catch (e) {
 | 
				
			||||||
			await new Promise(resolve => setTimeout(resolve, 3000));
 | 
								await new Promise(resolve => setTimeout(resolve, 3000));
 | 
				
			||||||
			start();
 | 
								start();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue