nashorn/samples/exec.js
changeset 31765 67d0d016d33a
parent 31489 fcccd041e11b
equal deleted inserted replaced
31764:c8288a6fc39a 31765:67d0d016d33a
    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