Skip to content

Commit

Permalink
check if file is a regular file
Browse files Browse the repository at this point in the history
  • Loading branch information
mingqi committed Oct 19, 2014
1 parent 68cfb48 commit 96dd7ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"url": "https://github.com/mingqi/tailF.git"
},
"main": "tail-forever.js",
"version": "0.3.3",
"version": "0.3.4",
"dependencies": {
"uclogs-async": "*",
"jschardet" : "*",
Expand Down
3 changes: 3 additions & 0 deletions tail-forever.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ class Tail extends events.EventEmitter
inode: if this parameters present, the start take effect if only file has same inode
###
try
stat = fs.statSync @filename
if not stat.isFile()
throw new Error("#{@filename} is not a regular file")
fd = fs.openSync(@filename, 'r')
stat = fs.fstatSync(fd)
@current = {fd: fd, inode: stat.ino}
Expand Down

0 comments on commit 96dd7ed

Please sign in to comment.