windows 7 - Java process.waitFor() does not return -
on windows 7 64 bit, running 64 bit java 1.7.0_17 , p.waitfor()
shown below never returns.
string move_command="cmd.exe /c xcopy /y /e "+x86_release+" "+path+"\\"; process p; p = runtime.getruntime().exec(move_command); p.waitfor();
if use windows explorer, looks files copied (same number, same size, etc.)
if below, waitfor()
return:
string move_command="cmd.exe /c move /y "+x86_release+" "+path+"\\"; process p; p = runtime.getruntime().exec(move_command); p.waitfor();
what different between xcopy
, move
keeps waitfor()
returning, or on wrong track entirely?
xcopy
happens produce more output move
, filling out-buffer , blocking until flushed. default behavior in java pipe subprocess's stdout/stderr inputstream
s required read programmatically lest subprocess's buffers overflow.
if latter case, solution simple, , in fact should anyway: use processbuilder
prepare system call , call inheritio
on it. reuse parent process`s stdin , stdout subprocess.
a side note, xcopy
regular .exe
file , doesn't need wrapping cmd.exe /c
.
Comments
Post a Comment