File: subprocess.lua

package info (click to toggle)
luxio 13-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 420 kB
  • ctags: 449
  • sloc: ansic: 3,117; makefile: 72; sh: 24
file content (20 lines) | stat: -rwxr-xr-x 378 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!../luxio-5.1

package.path = package.path .. ":../?.lua"
package.cpath = package.cpath .. ":../?.so"

sio = require "luxio.simple"
sp = require "luxio.subprocess"

mytr = sp.spawn_simple {
       "tr", "[a-z]", "[A-Z]",
       stdin = sp.PIPE,
       stdout = sp.PIPE,
}

mytr.stdin:write "Hello, world!\n"
mytr.stdin:close()

print(mytr.stdout:read "*a")

print(mytr:wait())