Coder Social home page Coder Social logo

Comments (18)

rizowski avatar rizowski commented on May 27, 2024 3

I am going to remove this from the 3.0 milestone and release the changes that have been made so far. I am hoping to get this fixed soon.

from eslint-watch.

rizowski avatar rizowski commented on May 27, 2024 2

@coryhouse I took another swing at this on Friday and tried to figure out what might be the cause. I think it may be two things. It's possible I am not shutting down other libraries correctly (Chokidar keypress) and they are holding onto the process. Or it's possible there may be a problem with parallel tasks with npm-run-all. Eslint-watch exits just fine if there isn't anything else running alongside it. (Could be short circuiting to single task and not take the parallel workflow)

I am leaning more towards the first option. Either way, I think I have an idea on how to solve this problem. Bad thing is, it incorporates a new workflow for the tool which means a decent size refactor.

Still thinking about it, I just wanted to give you an update.

from eslint-watch.

rizowski avatar rizowski commented on May 27, 2024 2

@coryhouse @brokentone or anyone else that may have run into this issue. I tried testing V5 on a previous version of React Slingshot to see if I could still reproduce the issue. Upgrading to esw@V5 made the issue go away. Although I've noticed that React Slingshot has since moved onto concurrently which does not seem to produce the problem. Sorry it took so long, but it should be fixed now in V5.

(Currently pushing out a few minor issues that weren't foreseen with the v5 release. But that should be out shortly.)

from eslint-watch.

rizowski avatar rizowski commented on May 27, 2024

Thanks for posting about this. I will take a look and see what I can dig up.

from eslint-watch.

rizowski avatar rizowski commented on May 27, 2024

@coryhouse I know I have had issues with npm-run-all before. but I'll have to look a little deeper into the issues to find it. Second note, I was looking at the sample project you provided, it doesn't provide the commands you might be running. Do you have two different watching processes running at the same time or anything like that? A little more detail should help figure out what might be going on.

I have seen this issue without the process being nested and definitely revolves around the watcher.
Looking up some information, here are some notes on exiting a process in nodejs: http://stackoverflow.com/a/9828572

from eslint-watch.

coryhouse avatar coryhouse commented on May 27, 2024

Thanks for the link. I've never seen npm scripts require me to hit Ctrl+C twice to exit. Usually only hitting it once is required. The answer on StackOverflow that mentions that you have to hit it twice is referring to the Node REPL.

Here's an example script that I'm referring to. I have to hit Ctrl+C twice to kill that script.

As you can see, one of the tools it's calling is eslint-watch. If I remove the call to lint:watch (which ultimately calls eslint-watch), it only requires hitting Ctrl+C once to kill the process.

from eslint-watch.

rizowski avatar rizowski commented on May 27, 2024

@coryhouse A little update so I can keep you informed. I was messing around with react-slingshot and I noticed that as soon as you saved an asset eslint-watch would exit after picking up the file change event. I hooked up process.on('SIGINT') and process.on('uncaughtException') to see what might be happening. I have at least found that Eslint is choking on trying to load eslint-plugin-react. Not sure if you have run into that issue before. I double checked to ensure the plugin was installed.

If that is the case, I am thinking it is most likely an issue with eslint-watch. As for the process requiring (CTRL + C) x2, it seems to be linked to the exception being thrown. If I handle the exception it will exit on the first CTRL + C. A little more investigating is required, however, one step forward. 😄

from eslint-watch.

coryhouse avatar coryhouse commented on May 27, 2024

Interesting. When you say "Eslint is choking with trying to load eslint-plugin-react", when is it "choking"?

from eslint-watch.

rizowski avatar rizowski commented on May 27, 2024

It happens after the file change event is fired. For some context, eslint-watch will spawn an eslint process for grabbing eslint's options and running the first lint. If the watch flag is specified, then it will use eslint's CLI-Engine for further linting.

from eslint-watch.

rizowski avatar rizowski commented on May 27, 2024

Linking #28 which also dealt with npm-run-all

from eslint-watch.

rizowski avatar rizowski commented on May 27, 2024

@coryhouse It might have been possible that I fixed this as well in the path-fix branch. Could you verify this for me?

from eslint-watch.

coryhouse avatar coryhouse commented on May 27, 2024

Unfortunately, this issue persists on the branch. I ran the branch in React Slingshot to confirm.

from eslint-watch.

coryhouse avatar coryhouse commented on May 27, 2024

Thanks for digging further! 👍 Appreciate your hard work and the update.

from eslint-watch.

rizowski avatar rizowski commented on May 27, 2024

@coryhouse I've done several fixes for the project in general and I came back to this issue to see if there was something else I could do. I ended up messing around with passing SIGINT SIGKILL and even tried doing process.abort(). I took pictures of the results:

Here is the logs with npm start being called on react-slingshot, eslint-watch process id being 17677:
process ID 17677

You can see that process running here in my monitor:
process monitor

I press CTRL + C and get the following executed code right before aborting.
aborting process 17677

Process monitor showing the pid no longer exists:
pid missing from process monitor

Even after that, it is still not exiting npm-run-all. I have tried looking up ways to identify if the process is being wrapped by a parent process such as detecting if the process.send function exists. It seems strange that the function exists regardless of if it is forked or spawned from a parent process. The documentation clearly states here that it would be undefined.

I am starting to wonder if there is a bug with the library npm-run-all uses for spawning child threads? I'm not entirely sure. I think the next step is to remove the key listener that I have on stdin and see if that still holds the parent process. If that doesn't then I am not entirely sure what would be causing the issue. 💩

from eslint-watch.

coryhouse avatar coryhouse commented on May 27, 2024

Tricky business! Thanks so much for digging in and for the update!

from eslint-watch.

rizowski avatar rizowski commented on May 27, 2024

@coryhouse You are using windows correct?

from eslint-watch.

coryhouse avatar coryhouse commented on May 27, 2024

I use both. Especially important since I author JavaScript courses for people on all platforms. :) Same story with the React Slingshot project I mentioned which is one example of where this issue is occurring. Thanks again for investigating!

from eslint-watch.

coryhouse avatar coryhouse commented on May 27, 2024

Great to hear! Thanks for the fix and followup @rizowski!

from eslint-watch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.