added bin: lsps
This commit is contained in:
		
							parent
							
								
									e73b4c4d14
								
							
						
					
					
						commit
						c4260aa719
					
				
							
								
								
									
										21
									
								
								src/bin/LSPS.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/bin/LSPS.hx
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
			
		||||
package bin;
 | 
			
		||||
 | 
			
		||||
import kernel.ps.ProcessManager;
 | 
			
		||||
import kernel.ps.ProcessHandle;
 | 
			
		||||
import kernel.ps.Process;
 | 
			
		||||
 | 
			
		||||
class LSPS implements Process {
 | 
			
		||||
    public function new() {}
 | 
			
		||||
 | 
			
		||||
	public function run(handle:ProcessHandle) {
 | 
			
		||||
        var pids = ProcessManager.listProcesses();
 | 
			
		||||
 | 
			
		||||
        handle.writeLine('Count: ${pids.length}');
 | 
			
		||||
 | 
			
		||||
        for (pid in pids) {
 | 
			
		||||
            handle.writeLine('${pid}');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        handle.close();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,5 +1,6 @@
 | 
			
		||||
package kernel.binstore;
 | 
			
		||||
 | 
			
		||||
import bin.LSPS;
 | 
			
		||||
import bin.Turtle;
 | 
			
		||||
import bin.Terminal;
 | 
			
		||||
import haxe.ds.ReadOnlyArray;
 | 
			
		||||
@ -21,7 +22,8 @@ class BinStore {
 | 
			
		||||
        {c: Net, name: "Net", aliases: ["net"]},
 | 
			
		||||
        {c: Redstone, name: "Redstone", aliases: ["redstone","rs"]},
 | 
			
		||||
        {c: Terminal, name: "Terminal", aliases: ["terminal","term"]},
 | 
			
		||||
        {c: Turtle, name: "Turtle", aliases: ["turtle"]}
 | 
			
		||||
        {c: Turtle, name: "Turtle", aliases: ["turtle"]},
 | 
			
		||||
        {c: LSPS, name: "PM", aliases: ["lsps"]}
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    @:allow(kernel.Init)
 | 
			
		||||
 | 
			
		||||
@ -34,4 +34,8 @@ class ProcessManager {
 | 
			
		||||
	private static function removeProcess(pid:PID):Void {
 | 
			
		||||
		processList.remove(pid);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static function listProcesses():Array<PID> {
 | 
			
		||||
		return [for (pid in processList.keys()) pid];
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user