mirror of
				https://github.com/go-delve/delve.git
				synced 2025-11-01 03:42:59 +08:00 
			
		
		
		
	Use descriptive const for readline history filename
This commit is contained in:
		
							
								
								
									
										7
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								main.go
									
									
									
									
									
								
							| @ -20,6 +20,8 @@ type term struct { | |||||||
| 	stdin *bufio.Reader | 	stdin *bufio.Reader | ||||||
| } | } | ||||||
|  |  | ||||||
|  | const historyFile string = ".dbg_history" | ||||||
|  |  | ||||||
| func main() { | func main() { | ||||||
| 	// We must ensure here that we are running on the same thread during | 	// We must ensure here that we are running on the same thread during | ||||||
| 	// the execution of dbg. This is due to the fact that ptrace(2) expects | 	// the execution of dbg. This is due to the fact that ptrace(2) expects | ||||||
| @ -43,8 +45,7 @@ func main() { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	dbgproc := beginTrace(pid, proc) | 	dbgproc := beginTrace(pid, proc) | ||||||
| 	history := ".dbg_history" | 	goreadline.LoadHistoryFromFile(historyFile) | ||||||
| 	goreadline.LoadHistoryFromFile(history) |  | ||||||
|  |  | ||||||
| 	for { | 	for { | ||||||
| 		cmdstr, err := t.promptForInput() | 		cmdstr, err := t.promptForInput() | ||||||
| @ -55,7 +56,7 @@ func main() { | |||||||
| 		cmdstr, args := parseCommand(cmdstr) | 		cmdstr, args := parseCommand(cmdstr) | ||||||
|  |  | ||||||
| 		if cmdstr == "exit" { | 		if cmdstr == "exit" { | ||||||
| 			err := goreadline.WriteHistoryToFile(history) | 			err := goreadline.WriteHistoryToFile(historyFile) | ||||||
| 			fmt.Println(err) | 			fmt.Println(err) | ||||||
| 			handleExit(t, dbgproc, 0) | 			handleExit(t, dbgproc, 0) | ||||||
| 		} | 		} | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Derek Parker
					Derek Parker