Comments (6)
It looks mostly fine. Some small points:
- You mention 'Karsimiov' but the linked blog says 'Krasimir'
- The title is not very descriptive, mention that you're killing a tree/family/group of processes
- The comment I made in 5280cd2
from birdseye-vscode.
https://stackoverflow.com/questions/33325301/killing-a-bash-script-does-not-kill-child-processes
This looks like it might work
from birdseye-vscode.
Nevermind - doesn't work for windows :/
Open a process with detached on windows causes the process to pop open with a console window.
Trying to kill with a negative pid results in Error: kill ESRCH
Apparently killing all children is not supported on windows :(
Or at least not with node - I could spin up a subprocess to nuke them in another language.
This guy did exactly that: http://krasimirtsonev.com/blog/article/Nodejs-managing-child-processes-starting-stopping-exec-spawn
from birdseye-vscode.
Confirmed fixed on windows :D
Still need to test on ubuntu
import {exec} from 'child_process'
/**
* kills the process and all its children
* If you are on linux process needs to be launched in detached state
* @param pid process identifier
* @param signal kill signal
*/
export function killAll(pid:number, signal:string|number='SIGKILL'){
if(process.platform == "win32"){
exec(`taskkill /PID ${pid} /T /F`, (error, stdout, stderr)=>{
console.log("stdout: " + stdout)
console.log("stdout: " + stderr)
if(error){
console.log("error: " + error.message)
}
})
}
else{
// see https://nodejs.org/api/child_process.html#child_process_options_detached
// If pid is less than -1, then sig is sent to every process in the process group whose ID is -pid.
process.kill(-pid, signal)
}
}
from birdseye-vscode.
Well forgot to test on ubuntu but I just tested on mac and it looks like it works
-
Launch birdseye
-
ps -ax | grep python
-
Two results
-
Close birdseye
-
ps -ax | grep python
-
no results.
@alexmojaki I published a medium article on how to kill processes with node - does the explanation make sense? Any thoughts?
https://medium.com/@almenon214/killing-processes-with-node-772ffdd19aad
from birdseye-vscode.
good catch. Fixed typo made in 5280cd2 and the gist. Updated the article to change the title and name.
https://medium.com/@almenon214/killing-processes-with-node-772ffdd19aad
from birdseye-vscode.
Related Issues (20)
- unit tests HOT 1
- show user output of birdseye when birdseye is loading HOT 5
- improve birdseye start speed HOT 1
- telemetry reporting HOT 1
- about Chinese decode error HOT 4
- report installation progress HOT 1
- birdseye allows you to install using a pip that does not match your python HOT 2
- move settings config to birdseye function
- check for update when user launches birdseye HOT 8
- birdseye does not show up upon install HOT 1
- Update eye icon to match birdseye
- Change name for seo
- Doesn't pick up that birdseye is running HOT 3
- New documentation HOT 4
- Poll localhost to check if birdseye is running instead of looking at text
- Catch schema change warning and display it to user HOT 2
- update birdseye to use webview HOT 1
- Can't see the code that is run HOT 1
- Interactive elements don't appear in the WebView tab 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 birdseye-vscode.