improve ps
This commit is contained in:
parent
ee68c78021
commit
cf04d4da15
|
@ -1,20 +1,24 @@
|
||||||
const { Terminal } = require("xterm");
|
const { Terminal } = require("xterm");
|
||||||
|
const sleep = require('../../lib/sleep');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {string[]} argv
|
* @param {string[]} argv
|
||||||
* @param {Terminal} terminal
|
* @param {Terminal} terminal
|
||||||
*/
|
*/
|
||||||
module.exports = (argv, terminal) => {
|
module.exports = async (argv, terminal) => {
|
||||||
if (argv.indexOf('--help') != -1) {
|
if (argv.indexOf('--help') != -1) {
|
||||||
terminal.write(
|
terminal.write(
|
||||||
`Usage: ${argv[0]} [OPTIONS]
|
`Usage: ${argv[0]} [OPTIONS]
|
||||||
Show current process list`);
|
Show current process list`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
terminal.write(
|
terminal.write('PID\tTTY\tTIME\t\tCMD');
|
||||||
`\tPID\tTTY\tTIME\tCMD
|
|
||||||
42\tpts/0\t00:00:00\tzsh
|
await sleep(5);
|
||||||
43\tpts/0\t00:00:00\tps
|
|
||||||
|
terminal.write(`
|
||||||
|
1\tpts/0\t00:00:00\tzsh
|
||||||
|
2\tpts/0\t00:00:00\tps
|
||||||
`);
|
`);
|
||||||
}
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = (timeout) => new Promise(r => setTimeout(r, timeout));
|
Loading…
Reference in New Issue