@@ -202,16 +202,24 @@ def start(self, wait=60, *, server_settings={}, **opts):
202
202
# of postgres daemon under an Administrative account
203
203
# is not permitted and there is no easy way to drop
204
204
# privileges.
205
+ if os .getenv ('ASYNCPG_DEBUG_SERVER' ):
206
+ stdout = sys .stdout
207
+ else :
208
+ stdout = subprocess .DEVNULL
209
+
205
210
process = subprocess .run (
206
211
[self ._pg_ctl , 'start' , '-D' , self ._data_dir ,
207
212
'-o' , ' ' .join (extra_args )],
208
- stdout = subprocess .DEVNULL , stderr = subprocess .DEVNULL )
209
- stderr = process .stderr
213
+ stdout = stdout , stderr = subprocess .STDOUT )
210
214
211
215
if process .returncode != 0 :
216
+ if process .stderr :
217
+ stderr = ':\n {}' .format (process .stderr .decode ())
218
+ else :
219
+ stderr = ''
212
220
raise ClusterError (
213
- 'pg_ctl start exited with status {:d}: {}' .format (
214
- process .returncode , stderr . decode () ))
221
+ 'pg_ctl start exited with status {:d}{}' .format (
222
+ process .returncode , stderr ))
215
223
else :
216
224
if os .getenv ('ASYNCPG_DEBUG_SERVER' ):
217
225
stdout = sys .stdout
@@ -448,6 +456,7 @@ def _test_connection(self, timeout=60):
448
456
try :
449
457
con = loop .run_until_complete (
450
458
asyncpg .connect (database = 'postgres' ,
459
+ user = 'postgres' ,
451
460
timeout = 5 , loop = loop ,
452
461
** self ._connection_addr ))
453
462
except (OSError , asyncio .TimeoutError ,
0 commit comments