Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tail node and corresponding tests don't work on Windows #698

Open
hbeeken opened this issue Aug 5, 2014 · 9 comments
Open

Tail node and corresponding tests don't work on Windows #698

hbeeken opened this issue Aug 5, 2014 · 9 comments

Comments

@hbeeken
Copy link

hbeeken commented Aug 5, 2014

There's a comment associated with the tail node saying "Linux and windows only". Would be nice if possible to make this work for Windows.

Also, the corresponding unit test fails on Windows, not only because the actual functionality doesn't work, but because there's a timing window where we look to write to the test file but the file does't exist. This has been seen once or twice on the Travis build. Note that the test uses

fs.unlinkSync(fileToTail);

which on linux deletes the file but on windows only deletes when the running process completes.

@knolleary
Copy link
Member

See also the comments in node-red/node-red#329

knolleary referenced this issue in node-red/node-red Aug 7, 2014
Proposed fix for Issue #326
@hbeeken
Copy link
Author

hbeeken commented Aug 7, 2014

@knolleary
Copy link
Member

Have just pushed 43ad8706aa067646cf7a6281c1aee49898f3d5ec which fixes a timing window in the tail node tests. The test file was being written asynchronously to the test running - so it was possible that the file didn't exist when the test tried to use it.

I've replaced that code with using a static file in the resources directory.

I've also added some TODOs on the node itself - including one to move over to node-tail.

Finally, we should add a test for when the file being tailed is deleted and recreated. This is why the -F argument is being used - so we continue to tail the new file. Once we have that test in place, we can do the rewrite to use node-tail.

@hbeeken
Copy link
Author

hbeeken commented Aug 11, 2014

Since the proposal is to switch to use node-tail and the current tail node isn't supposed to work on windows I'm just making a note here rather than proposing to fix the test....the tail node tests fail for me me on windows because there's an extra character found - "\r". Just to keep in mind there may still be differences between windows and linux.

@hbeeken
Copy link
Author

hbeeken commented Aug 13, 2014

see also issue node-red/node-red#337

@dceejay
Copy link
Member

dceejay commented Aug 21, 2014

There are several packages that do the equivalent of tail... some claim to support files going away / being renamed - which is functionality we want... eg https://www.npmjs.org/package/always-tail and https://www.npmjs.org/package/tailfd ... so need to evaluate them to select the most appropriate (as well as https://www.npmjs.org/package/tail )

It would also be nice if they support the behaviour created by the -n 0 option of the real tail command - ie only output new lines.

dceejay referenced this issue in node-red/node-red Aug 22, 2014
Now with test that works with it.
Part of Issue #326
Now need to redo with libs that support windows.
@knolleary
Copy link
Member

In my testing, always-tail is the closest to what we want. If/when they accept my pull-request, it'll be perfect.

@knolleary
Copy link
Member

Bumping from the 0.9 release; the PR still hasn't been accepted and the issue doesn't warrant holding up the release.

@knolleary knolleary transferred this issue from node-red/node-red Oct 9, 2020
@knolleary
Copy link
Member

Moved this issue over from the core repo so it follows the Tail node that was moved to this repo some time ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants