mirror of
				https://gogs.blitter.com/RLabs/xs
				synced 2024-08-14 10:26:42 +00:00 
			
		
		
		
	termmode.go: Added nil check in term.Restore() for nonexistent cp filename
Signed-off-by: Russ Magee <rmagee@gmail.com>
This commit is contained in:
		
							parent
							
								
									7c1464f084
								
							
						
					
					
						commit
						c12e3bca9e
					
				
					 2 changed files with 8 additions and 3 deletions
				
			
		|  | @ -298,7 +298,7 @@ func doCopyMode(conn *hkexnet.Conn, remoteDest bool, files string, rec *hkexsh.S | |||
| 					if status, ok := exiterr.Sys().(syscall.WaitStatus); ok { | ||||
| 						exitStatus = uint32(status.ExitStatus()) | ||||
| 						fmt.Print(stdErrBuffer) | ||||
| 						fmt.Printf("Exit Status: %d\n", exitStatus) //# | ||||
| 						//fmt.Printf("Exit Status: %d\n", exitStatus) //# | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
|  | @ -367,7 +367,7 @@ func doCopyMode(conn *hkexnet.Conn, remoteDest bool, files string, rec *hkexsh.S | |||
| 					// an ExitStatus() method with the same signature. | ||||
| 					if status, ok := exiterr.Sys().(syscall.WaitStatus); ok { | ||||
| 						exitStatus = uint32(status.ExitStatus()) | ||||
| 						log.Printf("Exit Status: %d", exitStatus) | ||||
| 						//log.Printf("Exit Status: %d", exitStatus) | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
|  |  | |||
|  | @ -3,6 +3,7 @@ | |||
| package hkexsh | ||||
| 
 | ||||
| import ( | ||||
| 	"errors" | ||||
| 	"io" | ||||
| 
 | ||||
| 	unix "golang.org/x/sys/unix" | ||||
|  | @ -67,7 +68,11 @@ func GetState(fd int) (*State, error) { | |||
| // Restore restores the terminal connected to the given file descriptor to a | ||||
| // previous state. | ||||
| func Restore(fd int, state *State) error { | ||||
| 	return unix.IoctlSetTermios(fd, ioctlWriteTermios, &state.termios) | ||||
| 	if state != nil { | ||||
| 		return unix.IoctlSetTermios(fd, ioctlWriteTermios, &state.termios) | ||||
| 	} else { | ||||
| 		return errors.New("nil State") | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| // ReadPassword reads a line of input from a terminal without local echo.  This | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue