Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -0,0 +1,15 @@
BEGIN {
ls = sys2var("ls")
print ls
}
function sys2var(command ,fish, scale, ship) {
command = command " 2>/dev/null"
while ( (command | getline fish) > 0 ) {
if ( ++scale == 1 )
ship = fish
else
ship = ship "\n" fish
}
close(command)
return ship
}

View file

@ -0,0 +1 @@
Run(@ComSpec & " /c " & 'pause', "", @SW_HIDE)

View file

@ -1 +1,9 @@
std.process.system("ls");
import std.process, std.stdio;
//these two alternatives wait for the process to return, and capture the output
//each process function returns a Tuple of (int)"status" and (string)"output
auto ls_string = executeShell("ls -l"); //takes single string
writeln((ls_string.status == 0) ? ls_string.output : "command failed");
auto ls_array = execute(["ls", "-l"]); //takes array of strings
writeln((ls_array.status == 0) ? ls_array.output : "command failed");
//other alternatives exist to spawn processes in parallel and capture output via pipes

View file

@ -0,0 +1 @@
run(`ls`)

View file

@ -3,4 +3,4 @@ run "ls" or die $!; # output to stdout
my @ls = qx/ls/; # output to variable
my $cmd = 'ls';
my @ls = qqx/$ls/; # same thing with interpolation
@ls = qqx/$cmd/; # same thing with interpolation

View file

@ -0,0 +1,7 @@
use std::process::Command;
fn main() {
let output = Command::new("ls").output().unwrap_or_else(|e| {
panic!("failed to execute process: {}", e)
});
println!("{}", String::from_utf8_lossy(&output.stdout));
}

View file

@ -0,0 +1 @@
system("ls");

View file

@ -0,0 +1,2 @@
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%comspec% /K dir",3,True