Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
2
Task/Fork/J/fork.j
Normal file
2
Task/Fork/J/fork.j
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
load'dll'
|
||||
Fork =: (('Error'"_)`('Parent'"_)`)(@.([: >: [: * '/lib/x86_64-linux-gnu/libc-2.19.so __fork > x' cd [: i. 0&[))
|
||||
4
Task/Fork/NewLISP/fork.newlisp
Normal file
4
Task/Fork/NewLISP/fork.newlisp
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(let (pid (fork (println "Hello from child")))
|
||||
(cond
|
||||
((nil? pid) (throw-error "Unable to fork"))
|
||||
('t (wait-pid pid))))
|
||||
16
Task/Fork/Scala/fork-1.scala
Normal file
16
Task/Fork/Scala/fork-1.scala
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import java.io.IOException
|
||||
|
||||
object Fork extends App {
|
||||
val builder: ProcessBuilder = new ProcessBuilder()
|
||||
val currentUser: String = builder.environment.get("USER")
|
||||
val command: java.util.List[String] = java.util.Arrays.asList("ps", "-f", "-U", currentUser)
|
||||
builder.command(command)
|
||||
try {
|
||||
val lines = scala.io.Source.fromInputStream(builder.start.getInputStream).getLines()
|
||||
println(s"Output of running $command is:")
|
||||
while (lines.hasNext) println(lines.next())
|
||||
}
|
||||
catch {
|
||||
case iox: IOException => iox.printStackTrace()
|
||||
}
|
||||
}
|
||||
14
Task/Fork/Scala/fork-2.scala
Normal file
14
Task/Fork/Scala/fork-2.scala
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import java.io.IOException
|
||||
|
||||
object Fork extends App {
|
||||
val command: java.util.List[String] = java.util.Arrays.asList("cmd.exe", "/C", "ECHO.| TIME")
|
||||
val builder: ProcessBuilder = new ProcessBuilder(command)
|
||||
try {
|
||||
val lines = scala.io.Source.fromInputStream(builder.start.getInputStream).getLines()
|
||||
println(s"Output of running $command is:")
|
||||
while (lines.hasNext) println(lines.next())
|
||||
}
|
||||
catch {
|
||||
case iox: IOException => iox.printStackTrace()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue