mirror of
				https://github.com/rclone/rclone.git
				synced 2025-10-30 23:17:59 +02:00 
			
		
		
		
	Stub out ReadPassword on plan9 and solaris to fix compilation
This commit is contained in:
		
							
								
								
									
										12
									
								
								fs/config.go
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								fs/config.go
									
									
									
									
									
								
							| @@ -28,7 +28,6 @@ import ( | ||||
| 	"github.com/mreiferson/go-httpclient" | ||||
| 	"github.com/spf13/pflag" | ||||
| 	"golang.org/x/crypto/nacl/secretbox" | ||||
| 	"golang.org/x/crypto/ssh/terminal" | ||||
| 	"golang.org/x/text/unicode/norm" | ||||
| ) | ||||
|  | ||||
| @@ -537,17 +536,6 @@ func ReadLine() string { | ||||
| 	return strings.TrimSpace(line) | ||||
| } | ||||
|  | ||||
| // ReadPassword reads a password | ||||
| // without echoing it to the terminal. | ||||
| func ReadPassword() string { | ||||
| 	line, err := terminal.ReadPassword(int(os.Stdin.Fd())) | ||||
| 	fmt.Println("") | ||||
| 	if err != nil { | ||||
| 		log.Fatalf("Failed to read password: %v", err) | ||||
| 	} | ||||
| 	return strings.TrimSpace(string(line)) | ||||
| } | ||||
|  | ||||
| // Command - choose one | ||||
| func Command(commands []string) byte { | ||||
| 	opts := []string{} | ||||
|   | ||||
							
								
								
									
										26
									
								
								fs/config_read_password.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								fs/config_read_password.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| // ReadPassword for OSes which are supported by golang.org/x/crypto/ssh/terminal | ||||
| // See https://github.com/golang/go/issues/14441 - plan9 | ||||
| //     https://github.com/golang/go/issues/13085 - solaris | ||||
|  | ||||
| // +build !solaris,!plan9 | ||||
|  | ||||
| package fs | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"log" | ||||
| 	"os" | ||||
| 	"strings" | ||||
|  | ||||
| 	"golang.org/x/crypto/ssh/terminal" | ||||
| ) | ||||
|  | ||||
| // ReadPassword reads a password without echoing it to the terminal. | ||||
| func ReadPassword() string { | ||||
| 	line, err := terminal.ReadPassword(int(os.Stdin.Fd())) | ||||
| 	fmt.Println("") | ||||
| 	if err != nil { | ||||
| 		log.Fatalf("Failed to read password: %v", err) | ||||
| 	} | ||||
| 	return strings.TrimSpace(string(line)) | ||||
| } | ||||
							
								
								
									
										12
									
								
								fs/config_read_password_unsupported.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								fs/config_read_password_unsupported.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| // ReadPassword for OSes which are not supported by golang.org/x/crypto/ssh/terminal | ||||
| // See https://github.com/golang/go/issues/14441 - plan9 | ||||
| //     https://github.com/golang/go/issues/13085 - solaris | ||||
|  | ||||
| // +build solaris plan9 | ||||
|  | ||||
| package fs | ||||
|  | ||||
| // ReadPassword reads a password with echoing it to the terminal. | ||||
| func ReadPassword() string { | ||||
| 	return ReadLine() | ||||
| } | ||||
		Reference in New Issue
	
	Block a user