镜像来自
				https://github.com/sammy-ette/Hilbish
				synced 2025-08-10 02:52:03 +00:00 
			
		
		
		
	feat: Add command.exit signal to bait
This commit is contained in:
		
							父節點
							
								
									23f6986123
								
							
						
					
					
						當前提交
						c8d2c47319
					
				
							
								
								
									
										3
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								main.go
									
									
									
									
									
								
							@ -108,6 +108,7 @@ func main() {
 | 
				
			|||||||
		if err == nil {
 | 
							if err == nil {
 | 
				
			||||||
			// If it succeeds, add to history and prompt again
 | 
								// If it succeeds, add to history and prompt again
 | 
				
			||||||
			readline.AddHistory(cmdString)
 | 
								readline.AddHistory(cmdString)
 | 
				
			||||||
 | 
								bait.Em.Emit("command.exit", nil)
 | 
				
			||||||
			bait.Em.Emit("command.success", nil)
 | 
								bait.Em.Emit("command.success", nil)
 | 
				
			||||||
			continue
 | 
								continue
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -162,12 +163,14 @@ func main() {
 | 
				
			|||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					if code, ok := interp.IsExitStatus(err); ok {
 | 
										if code, ok := interp.IsExitStatus(err); ok {
 | 
				
			||||||
						if code > 0 {
 | 
											if code > 0 {
 | 
				
			||||||
 | 
												bait.Em.Emit("command.exit", nil)
 | 
				
			||||||
							bait.Em.Emit("command.fail", code)
 | 
												bait.Em.Emit("command.fail", code)
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					fmt.Fprintln(os.Stderr, err)
 | 
										fmt.Fprintln(os.Stderr, err)
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
 | 
									bait.Em.Emit("command.exit", nil)
 | 
				
			||||||
				bait.Em.Emit("command.success", nil)
 | 
									bait.Em.Emit("command.success", nil)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user