Last active
July 19, 2021 09:38
-
-
Save stelf/53837cff216b1815c105489045ea572e to your computer and use it in GitHub Desktop.
monitor bash processes via rxjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this GIST is available under the conditions of | |
// https://creativecommons.org/licenses/by/4.0/ | |
const psList = require('ps-list'); | |
const { interval, from } = require('rxjs'); | |
const { switchMap, filter, map } = require('rxjs/operators'); | |
interval(500) | |
.pipe( switchMap(() => psList()), | |
switchMap(e => from(e)), | |
filter(e => e.name === 'bash'), | |
) | |
.subscribe(console.log); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment