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