How to fix truncated output java from a powershell command. When i execute my command line directly from cmd i get this results
powershell C:\CMDLETS\getaccountattributes.ps1
Key Value
--- -----
address2_county 7d8b4132e6a6e44682046b524f3904ca@O=IAM;
15dc3a803c4012479db49b28c9e590c5@O=IAM
systemuserid a418a064-a1ed-e811-80e9-005056bd633b
accessmode Microsoft.Xrm.Sdk.OptionSetValue
but when i run this in java:
ExecuteShellComand executeshellecomand = new ExecuteShellComand();
String command = "powershell C:\\CMDLETS\\getaccountattributes.ps1";
log.info("avant exctuion du shell");
String output = executeshellecomand.executeCommand(command);
log.info("Val of output " +output);
BufferedReader reader = new BufferedReader( new StringReader(output) )
String executeCommand(String command) {
StringBuffer output = new StringBuffer();
StringBuffer outputError = new StringBuffer();
Process p;
try {
p = Runtime.getRuntime().exec(command);
log.info("runtime powerhsel "+ p.getInputStream().toString());
int test= p.waitFor();
String line = "", errorLine = "" ;
BufferedReader reader =
new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader errinput = new BufferedReader(new InputStreamReader(
p.getErrorStream()));
while ((line = reader.readLine())!= null) {
output.append(line + "\n");
}
} catch (Exception e) {
e.printStackTrace();
}
return output.toString();
Results :
Key Value
--- -----
address2_county 7d8b4132e6a6e44682046b524f3904ca@O=IAM;15d...
systemuserid a418a064-a1ed-e811-80e9-005056bd633b
accessmode Microsoft.Xrm.Sdk.OptionSetValue
the first attribute was truncated. How do i get my desired result please. Thanks!