mirror of
https://github.com/ValKmjolnir/Nasal-Interpreter.git
synced 2026-05-02 19:00:47 +08:00
✨ add template get/convert for ghost
This commit is contained in:
11
test/for_subprocess_test/infinite_loop.nas
Normal file
11
test/for_subprocess_test/infinite_loop.nas
Normal file
@@ -0,0 +1,11 @@
|
||||
use std.unix;
|
||||
|
||||
var count = 0;
|
||||
while(1) {
|
||||
unix.sleep(0.1);
|
||||
count += 0.1;
|
||||
println("process running time: ", count);
|
||||
if (count > 2) {
|
||||
die("test failed");
|
||||
}
|
||||
}
|
||||
13
test/subprocess_test.nas
Normal file
13
test/subprocess_test.nas
Normal file
@@ -0,0 +1,13 @@
|
||||
use std.subprocess;
|
||||
use std.unix;
|
||||
|
||||
var process = subprocess.create([
|
||||
"./nasal",
|
||||
"test/for_subprocess_test/infinite_loop.nas"
|
||||
]);
|
||||
|
||||
unix.sleep(1);
|
||||
|
||||
println("kill subprocess...");
|
||||
var res = subprocess.terminate(process);
|
||||
println("subprocess killed, code ", res);
|
||||
Reference in New Issue
Block a user