mirror of
				https://github.com/sammy-ette/Hilbish
				synced 2025-08-10 02:52:03 +00:00 
			
		
		
		
	fix: deregister commander if return isnt number
This commit is contained in:
		
							parent
							
								
									0826839846
								
							
						
					
					
						commit
						b39083fe32
					
				
							
								
								
									
										9
									
								
								exec.go
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								exec.go
									
									
									
									
									
								
							@ -192,8 +192,7 @@ func execCommand(cmd string, terminalOut bool) (io.Writer, io.Writer, error) {
 | 
				
			|||||||
		if commands[args[0]] != nil {
 | 
							if commands[args[0]] != nil {
 | 
				
			||||||
			luaexitcode, err := rt.Call1(l.MainThread(), rt.FunctionValue(commands[args[0]]), rt.TableValue(luacmdArgs))
 | 
								luaexitcode, err := rt.Call1(l.MainThread(), rt.FunctionValue(commands[args[0]]), rt.TableValue(luacmdArgs))
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				fmt.Fprintln(os.Stderr,
 | 
									fmt.Fprintln(os.Stderr, "Error in command:\n\n" + err.Error())
 | 
				
			||||||
					"Error in command:\n\n" + err.Error())
 | 
					 | 
				
			||||||
				return interp.NewExitStatus(1)
 | 
									return interp.NewExitStatus(1)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -201,7 +200,11 @@ func execCommand(cmd string, terminalOut bool) (io.Writer, io.Writer, error) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			if code, ok := luaexitcode.TryInt(); ok {
 | 
								if code, ok := luaexitcode.TryInt(); ok {
 | 
				
			||||||
				exitcode = uint8(code)
 | 
									exitcode = uint8(code)
 | 
				
			||||||
			} // TODO: deregister commander if return isnt number
 | 
								} else if luaexitcode != rt.NilValue {
 | 
				
			||||||
 | 
									// deregister commander
 | 
				
			||||||
 | 
									delete(commands, args[0])
 | 
				
			||||||
 | 
									fmt.Fprintf(os.Stderr, "Commander did not return number for exit code. %s, you're fired.\n", args[0])
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			return interp.NewExitStatus(exitcode)
 | 
								return interp.NewExitStatus(exitcode)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user