Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
debomatic-webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
debomatic-webui-admins
debomatic-webui
Commits
21db8f2e
Commit
21db8f2e
authored
Jul 17, 2014
by
Leo Iannacone
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extends Tail in pure coffee
parent
37c4f95e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
23 deletions
+16
-23
debomatic-webui/lib/tail.coffee
debomatic-webui/lib/tail.coffee
+16
-23
No files found.
debomatic-webui/lib/tail.coffee
View file @
21db8f2e
"use strict"
fs
=
require
(
"fs"
)
Tail
=
require
(
"tail"
).
Tail
Tail
::
watchEvent
=
(
e
)
->
_this
=
this
if
e
is
"change"
fs
.
stat
@
filename
,
(
err
,
stats
)
->
if
err
_this
.
emit
"error"
,
err
return
_this
.
pos
=
stats
.
size
if
stats
.
size
<
_this
.
pos
if
stats
.
size
>
_this
.
pos
_this
.
queue
.
push
start
:
_this
.
pos
end
:
stats
.
size
_this
.
pos
=
stats
.
size
_this
.
internalDispatcher
.
emit
"next"
if
_this
.
queue
.
length
is
1
class
MyTail
extends
Tail
else
if
e
is
"rename"
@
unwatch
()
_this
.
emit
"error"
,
"File "
+
@
filename
+
" deleted."
return
watchEvent
:
(
e
)
->
if
e
is
'change'
stats
=
fs
.
statSync
(
@
filename
)
@
pos
=
stats
.
size
if
stats
.
size
<
@
pos
#scenario where texts is not appended but it's actually a w+
if
stats
.
size
>
@
pos
@
queue
.
push
({
start
:
@
pos
,
end
:
stats
.
size
})
@
pos
=
stats
.
size
@
internalDispatcher
.
emit
(
"next"
)
if
@
queue
.
length
is
1
else
if
e
is
'rename'
@
unwatch
()
@
emit
"error"
,
"File "
+
@
filename
+
" deleted."
Tail
::
close
=
->
@
unwatch
()
return
close
:
()
->
@
unwatch
()
return
module
.
exports
=
Tail
module
.
exports
=
My
Tail
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment