samples/exec.js

changeset 1819
5e1012e665bf
parent 1405
98b090e45df3
equal deleted inserted replaced
1818:39774ec26126 1819:5e1012e665bf
37 37
38 // It can also be given a string to use as stdin: 38 // It can also be given a string to use as stdin:
39 $EXEC("cat", "Hello, world!") 39 $EXEC("cat", "Hello, world!")
40 40
41 // Additional arguments can be passed after the stdin argument, as an array of 41 // Additional arguments can be passed after the stdin argument, as an array of
42 // strings, or a sequence of varargs: 42 // strings, or a sequence of varargs (if there is no stdin, null or undefined
43 $EXEC("ls", "" /* no stdin */, "-l", "-a") 43 // can be passed):
44 $EXEC("ls", "" /* no stdin */, ["-l", "-a"]) 44 $EXEC("ls", undefined, "-l", "-a")
45 $EXEC("ls", undefined, ["-l", "-a"])
45 46
46 // Output of running external commands is returned from $EXEC: 47 // Output of running external commands is returned from $EXEC:
47 print($EXEC("ls")) 48 print($EXEC("ls"))
48 49
49 // apply on $EXEC 50 // apply on $EXEC

mercurial