Skip to content

Commit 7291a03

Browse files
committed
Merge branch 'development'
2 parents 89a95e9 + a458f2f commit 7291a03

File tree

3 files changed

+44
-19
lines changed

3 files changed

+44
-19
lines changed

build/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ java.debug=true
1212
dependencies.dir=${basedir}/lib
1313
cfml.version=5.4.6.9
1414
# Compress Tags
15-
cfml.extensions=8D7FB0DF-08BB-1589-FE3975678F07DB17
15+
cfml.extensions=8D7FB0DF-08BB-1589-FE3975678F07DB17?version=1.0.0.15
1616
box.bunndled.modules=commandbox-update-check,commandbox-cfconfig,commandbox-dotenv,contentbox-cli,coldbox-cli,testbox-cli,commandbox-boxlang
1717
cfml.loader.version=2.8.5
1818
cfml.cli.version=${cfml.loader.version}.${cfml.version}

build/build.xml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ External Dependencies:
1616
<property name="distro.groupID" value="ortussolutions" />
1717
<property name="distro.name" value="commandbox"/>
1818
<!-- Special things happen when the version and stableVersion are the same value as that signifies a "stable" build. -->
19-
<property name="commandbox.version" value="6.2.0"/>
20-
<property name="commandbox.stableVersion" value="6.2.0"/>
19+
<property name="commandbox.version" value="6.2.1"/>
20+
<property name="commandbox.stableVersion" value="6.2.1"/>
2121

2222
<!-- Time Label -->
2323
<tstamp prefix="start"/>
@@ -177,9 +177,11 @@ External Dependencies:
177177
</move>
178178

179179
<!-- unzip the core.lco file (really a jar) so we can modify the manifest to inject the extensions we need to load -->
180+
<propertyregex property="cfml.extensions.modified" input="${cfml.extensions}" regexp="\?" replace=";" />
181+
180182
<unzip src="${temp.dir}/core.lco" dest="${temp.dir}/lucee-light-core/" overwrite="true"/>
181183
<manifest file="${temp.dir}/lucee-light-core/META-INF/MANIFEST.MF" mode="update">
182-
<attribute name="Require-Extension" value="${cfml.extensions}"/>
184+
<attribute name="Require-Extension" value="${cfml.extensions.modified}"/>
183185
</manifest>
184186

185187
<!-- Re-zip core file] -->
@@ -1065,9 +1067,11 @@ External Dependencies:
10651067

10661068
<for list="${cfml.extensions}" param="id">
10671069
<sequential>
1070+
<propertyregex property="id.noVersion" input="@{id}" regexp="\?version=.*" replace="" />
1071+
10681072
<echo>Downloading extension @{id}</echo>
10691073

1070-
<get src="http://extension.lucee.org/rest/extension/provider/full/@{id}" dest="${extensions.dir}/@{id}.lex" verbose="true" />
1074+
<get src="http://extension.lucee.org/rest/extension/provider/full/@{id}" dest="${extensions.dir}/@{id.noVersion}.lex" verbose="true" />
10711075

10721076
</sequential>
10731077
</for>

src/cfml/system/modules_app/system-commands/commands/tail.cfc

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
} else {
8181
lastLF=false;
8282
}
83-
if ( char != -1 ) buffer.append( chr( char ) );
83+
if ( char != -1 ) buffer.append( char );
8484

8585
position--;
8686

@@ -96,14 +96,18 @@
9696

9797
if( buffer.len() ) {
9898
// Strip any CR or LF from the last (first really) line to eliminate leading line breaks in console output
99-
buffer[ buffer.len() ] = listChangeDelims( buffer[ buffer.len() ], '', chr(13) & chr( 10 ) );
99+
loop times=2 {
100+
if( buffer[ buffer.len() ] == 10 || buffer[ buffer.len() ] == 13 ) {
101+
buffer.deleteAt( buffer.len() );
102+
}
103+
}
100104
}
105+
buffer = createObject("java", "java.lang.String").init(buffer.reverse(), "UTF-8");
106+
101107

102108
// print our file to console
103109
print
104-
.text( buffer
105-
.reverse()
106-
.toList( "" )
110+
.text( buffer
107111
.listToArray( chr( 13 ) & chr( 10 ) )
108112
.map( function( line ) {
109113
return ansiFormatter.cleanLine( line );
@@ -137,24 +141,41 @@
137141
threadName = 'tail#createUUID()#';
138142
thread action="run" name=threadName priority="HIGH" {
139143
try{
144+
var buffer = [];
140145
// Only keep drawing as long as the main thread is active
141146
while( variables.tailRun ) {
142-
143-
var randomAccessFile = createObject( "java", "java.io.RandomAccessFile" ).init( file, "r" );
144-
randomAccessFile.seek( position );
145-
var line = randomAccessFile.readLine();
146-
while( !isnull( line ) ){
147-
147+
if( isNull( randomAccessFile ) ) {
148+
var randomAccessFile = createObject( "java", "java.io.RandomAccessFile" ).init( file, "r" );
149+
randomAccessFile.seek( position );
150+
}
151+
152+
// Don't convert to chars yet, just read the bytes
153+
var byte = randomAccessFile.read();
154+
155+
if ( byte != -1 ) buffer.append( byte );
156+
157+
// If we reached the end of a line or the end of the file (and there are bytes in the buffer), print it out
158+
if( byte == 13 || byte == 10 || ( byte == -1 && buffer.len() ) ) {
159+
// Convert byte array to UTF-8 encoded string
160+
var line = createObject("java", "java.lang.String").init(buffer, "UTF-8");
161+
buffer.clear();
148162
line = ansiFormatter.cleanLine( line );
149163
print
150-
.line( line )
164+
.text( line )
151165
.toConsole();
152-
153-
var line = randomAccessFile.readLine();
154166
}
167+
168+
// If we aren't at the end of the file, keep reading
169+
if( byte != -1) {
170+
continue;
171+
}
172+
173+
// At the end of the file, let's close it, wait a few ms and try again
174+
155175
// Close the file every time so we don't keep it open and locked
156176
position = randomAccessFile.getFilePointer();
157177
randomAccessFile.close();
178+
structDelete( local, 'randomAccessFile' );
158179

159180
// Decrease this to speed up the Tail
160181
sleep( 300 );

0 commit comments

Comments
 (0)