From b22d3361cfab9b9f1674cdf68c4a2120d406ef4d Mon Sep 17 00:00:00 2001 From: Matthias Welk Date: Tue, 27 Sep 2022 19:38:29 +0200 Subject: [PATCH] NativeProcess.standardOutputData can be fired multiple times depending on the output buffer size. All output data now gets collected over time and hash gets only parsed if process finished successfully --- .../processes/generic/ChecksumWindowsProcess.as | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/client/src/com/apm/client/processes/generic/ChecksumWindowsProcess.as b/client/src/com/apm/client/processes/generic/ChecksumWindowsProcess.as index c43a119..07fe0ea 100644 --- a/client/src/com/apm/client/processes/generic/ChecksumWindowsProcess.as +++ b/client/src/com/apm/client/processes/generic/ChecksumWindowsProcess.as @@ -100,15 +100,7 @@ package com.apm.client.processes.generic private function onOutputData( event:ProgressEvent ):void { var output:String = _process.standardOutput.readUTFBytes( _process.standardOutput.bytesAvailable ); - var lines:Array = output.split( "\n" ); - if (lines.length > 1) - { - _data = String(lines[1]) - .replace( /\n/g, "" ) - .replace( /\r/g, "" ) - .replace( /\t/g, "" ) - .replace( / /g, "" ); - } + _data += output; } @@ -124,7 +116,8 @@ package com.apm.client.processes.generic // APM.io.stopSpinner( event.exitCode == 0, " checksum calculated" ); if (event.exitCode == 0) { - var checksum:String = _data; + var hashRegExp:RegExp = /^[A-Fa-f0-9]{64}$/m; + var checksum:String = hashRegExp.exec(_data); complete( checksum ); } else