diff -ur v6/ftp_ut.py v7/ftp_ut.py --- v6/ftp_ut.py 2020-02-14 00:11:24.000000000 +0900 +++ v7/ftp_ut.py 2020-02-15 11:46:49.000000000 +0900 @@ -12,7 +12,7 @@ to_str = base.to_str def new(host, user, passwd, tmout1=15, tmout2=1, debug=False): - ftp_cmd = 'ftp -n' + ftp_cmd = 'python -m pty_spawn ftp -n' proc = cmd_ut.proc_new_comm_tm2( ftp_cmd, tmout1, tmout2 ) write = lambda s: proc.write( s + '\n' ) @@ -32,6 +32,7 @@ 'open {}'.format( host ), 'user {} {}'.format( user, passwd ), 'bin', + 'verb off', 'prompt off', ] write( to_str(lst) ) @@ -39,6 +40,11 @@ def quit(): write('quit') + r = read() + if debug: + dbg.out( r, '' ) + dbg.out + proc.kill() proc.wait() do_cmd = lambda cmd, prm='': write( to_str( (cmd, prm), delim=' ' ) ) @@ -193,8 +199,10 @@ ( p0, p1_ ) = ( paths[0], paths[1:] ) quiet = p0 in ( 'ls', 'lst' ) - ftp.login() + r = ftp.login() if not quiet: + if r and debug: + dbg.out( r, '' ) dbg.out('login') if cd: @@ -215,6 +223,6 @@ r = ftp.do_paths( ftp.lstf, p1_ ) if p1_ else ftp.lstf() else: r = ftp.do_paths( ftp.put, p1_ if p0 == 'put' else paths ) - dbg.out( r, '') + dbg.out( r, '' ) ftp.quit() # EOF