File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,12 +46,13 @@ class ClientParameterError(Error):
4646class ServiceDoesNotExistError (ClientParameterError ):
4747 code = '-*srv'
4848
49- try :
50- from getpass import getuser , getpass
51- except ImportError :
52- getpass = raw_input
53- def getuser ():
54- return 'postgres'
49+ # on win32 when program is run as windows service, getuser falls back to pwn which is not implemented
50+ # therefore it is better to resign from getting default username, which allows service operation
51+
52+ getpass = raw_input
53+
54+ def getuser ():
55+ return 'postgres'
5556
5657default_host = 'localhost'
5758default_port = 5432
@@ -141,6 +142,9 @@ def defaults(environ = os.environ):
141142 if appdata :
142143 pgdata = os .path .join (appdata , pg_appdata_directory )
143144 pgpassfile = os .path .join (pgdata , pg_appdata_passfile )
145+ else :
146+ pgdata = ''
147+ pgpassfile = ''
144148 else :
145149 pgpassfile = os .path .join (userdir , pg_home_passfile )
146150
You can’t perform that action at this time.
0 commit comments