Comments (9)
This is how the native childProcess.exec()
works too. It would indeed be useful, but I don't really see how it would be possible to know what processes are executed as it's the shell that spawns them, not Node.js. Thoughts? I would suggest you instead use execa('ipfs', ['daemon'])
both for performance and security reasons.
from execa.
This is how the native childProcess.exec() works too
Yes, sadly :( That's why I thought this might be a good place to improve on it :)
but I don't really see how it would be possible to know what processes are executed
What I currently do is keep track of the processes I spawn and attach handlers to exit
and SIGINT
on process
to clean them up immediately before node.js exits. I totally understand if you think this is out of scope for this library but I wanted to mention as I can imagine me not being the only person needing this.
It probably would make sense to have this behind an option though rather than enabling it by default.
I would suggest you instead use execa('ipfs', ['daemon']) both for performance and security reasons.
The thing is that ipfs
is not a node.js script but rather a binary out of my control.
from execa.
execa('ipfs', ['daemon'])
works with any binary, not just Node.js.
from execa.
execa('ipfs', ['daemon']) works with any binary, not just Node.js.
Right..silly me. But I encounter the same issue with that, the process is spawned but not terminated when the parent exits.
from execa.
Hmm. I assumed Node.js would clean up direct child processes when exiting. Sounds like something it should do. Can you try opening an issue on Node.js first? And comment the link here. Would be better to try to fix it for everyone, not just this module. If they decline, we can add it here.
from execa.
Sure, I will do that later tonight
from execa.
Just filed an issue with a minimal example: nodejs/node#7951
from execa.
So as you can see from the issue this is the expected unixy behaviour. I still think it would be a great addition to optionally destroy the spawned process in this module. To catch that as referenced in the issue we could use https://www.npmjs.com/package/signal-exit.
Let me know if you are interested and I can work on a PR for adding this tracking behaviour.
from execa.
I'm not surprised. Unexpected behavior usually is expected UNIX behavior...
Sure, PR welcome :)
from execa.
Related Issues (20)
- breaking changes not included in v9 release notes HOT 5
- Promise-based IPC HOT 2
- Remove `execaCommand()`
- Deprecating old `ipc` option HOT 1
- The `stdin` and `stdout` options must not target a file path string that is the same. HOT 2
- Export `Execa` and `ExecaScript` types. HOT 2
- v9.1.0 possible bug HOT 4
- template syntax HOT 2
- Select specific IPC messages
- Avoid race conditions with IPC
- backup-file-in-package HOT 2
- Cannot set properties of null (setting 'peer') HOT 1
- 9.2.0 release post HOT 2
- execa with env option not working HOT 5
- Do not disconnect IPC on `error` event
- Not able to inject environment variables HOT 3
- Node.js engine version in package.json is not up-to-date HOT 6
- Document CLI utilities
- Subprocess is considered as failed exit when using `process.kill` on windows only HOT 6
- Graceful termination HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from execa.