python - Issue with the one line output when executing psexec command from subprocess.Popen -
i'm trying run , output of following command using psexec.
'psexec.exe -accepteula \\172.16.196.162 -u administrator -p builder!12 cmd.exe /c dir /b /s c:\\dir1'
this command executed python using subprocess.popen().
please ignore rest of variables such psexecmdpath
_childprocess = subprocess.popen(psexecmdpath + "\\" + 'psexec.exe -accepteula \\\\172.16.196.162 -u administrator -p builder!12 cmd.exe /c dir /b /s c:\\dir1', 0, none, none, subprocess.pipe, subprocess.pipe, none, false, false)
the problem i'm facing when output stored in _output.
given below snippet of code this.
_childprocess = subprocess.popen(_cmd, 0, none, none, outfileobj, errorfileobj, none, false, true, psexecmdpath) retcode = _childprocess.wait() #after process has unblocked, it's safe assume no more writes being made. must return beginning in a+ mode. outfileobj.seek(0) errorfileobj.seek(0) _output = outfileobj.readlines()
the directory in question on remote machine has bunch of files yet output 1 line name of last file in directory.
can please tell me why i'm not getting full multi-line output ? can provide more details if necessary
Comments
Post a Comment