Giter Site home page Giter Site logo

What is detached mode? about grunt-exec HOT 5 CLOSED

noomorph avatar noomorph commented on June 25, 2024
What is detached mode?

from grunt-exec.

Comments (5)

noomorph avatar noomorph commented on June 25, 2024

Or you meant detached from here: https://nodejs.org/api/child_process.html ?

from grunt-exec.

gwicksted avatar gwicksted commented on June 25, 2024

You are correct. Have not updated the docs yet. Needs more testing to cover some edge cases (as discovered in #79) before release since it was a major change switching from exec to spawn.

from grunt-exec.

noomorph avatar noomorph commented on June 25, 2024

@gwicksted, thanks. Initially, I've thought about a different scenario, and to be honest, I'm still looking for the appropriate solution for this and I want to share my problem.

Imagine, I've got several 3rd-party CLI tools supporting --watch mode. Usually, it means that whenever I run them, they do a full amount of work and then start watching for individual file changes.

  1. tsc -p path/to/tsconfig.json --watch
  2. webpack --config path/to/webpack.dev.config.js --watch
  3. karma start path/to/karma.conf.js --auto-watch

For me it looks perfectly fine to write accordingly three tasks: exec:ts-watch, exec:webpack-watch, exec:karma-watch, but it looks like that grunt-ts does not support yet some kind of "detachment" from its tasks that I need in my case. Maybe I'm wrong.

I mean that if write:

grunt.registerTask('serve', ['exec:ts-watch', 'exec:webpack-watch', 'exec:karma-watch', 'watch:dev']);

I'll be stuck forever on 'exec:ts-watch'.
Instead, I would like to see some child process creation that will guarantee that after the parent grunt process is finished or killed, we'll also clean up after ourselves and kill all exec:*-watch tasks. Once we created child process , we report that the task has finished its work. Ideally, the exact moment of done() is nice to have under control in some options.afterChildProcessCreatedCallback.

So, I've started some sort of experimenting here: https://github.com/noomorph/grunt-exec/commit/b10a95fdbf7279f08719b47af668ea7e4a547726#diff-f7fa85a898002b4e35a70421dcca8ab4R248

Maybe, you could advise me in which direction it is better to move?

from grunt-exec.

gwicksted avatar gwicksted commented on June 25, 2024

Might be overkill but forever (npm here) gives you the flexibility to do just about anything with background processes. There is also an async task for grunt but that simply allows multiple tasks to be run in parallel and you probably want your terminal back after executing grunt... another option if you're in linux: try using screen (gnu man) -- I haven't tried it with tsc but I assume no compatibility issues. Then you can reattach with screen -r or kill the pid to stop it.

from grunt-exec.

noomorph avatar noomorph commented on June 25, 2024

Thanks, @gwicksted . Your suggestions do not match my needs but I realized that using grunt-exec in my case is not a right decision. I should be modifying grunt-ts probably.

from grunt-exec.

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.