June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
9
Task/Fork/D/fork.d
Normal file
9
Task/Fork/D/fork.d
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import core.thread;
|
||||
import std.stdio;
|
||||
|
||||
void main() {
|
||||
new Thread({
|
||||
writeln("Spawned thread.");
|
||||
}).start;
|
||||
writeln("Main thread.");
|
||||
}
|
||||
26
Task/Fork/Kotlin/fork.kotlin
Normal file
26
Task/Fork/Kotlin/fork.kotlin
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// version 1.1.51
|
||||
|
||||
import java.io.InputStreamReader
|
||||
import java.io.BufferedReader
|
||||
import java.io.IOException
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
try {
|
||||
val pb = ProcessBuilder()
|
||||
val currentUser = pb.environment().get("USER")
|
||||
val command = listOf("ps", "-f", "U", currentUser)
|
||||
pb.command(command)
|
||||
val proc = pb.start()
|
||||
val isr = InputStreamReader(proc.inputStream)
|
||||
val br = BufferedReader(isr)
|
||||
var line: String? = "Output of running $command is:"
|
||||
while(true) {
|
||||
println(line)
|
||||
line = br.readLine()
|
||||
if (line == null) break
|
||||
}
|
||||
}
|
||||
catch (iox: IOException) {
|
||||
iox.printStackTrace()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue