Class: Coque::Cmd
Direct Known Subclasses
Rb, Sh
Instance Attribute Summary collapse
Attributes included from Redirectable
#stderr, #stdin, #stdout
Instance Method Summary
collapse
Methods included from Runnable
#log_start, #run, #run!, #success?, #to_a, #to_a!
#<, #>, #>=, #err, #getio, #in, #out
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
5
6
7
|
# File 'lib/coque/cmd.rb', line 5
def context
@context
end
|
Instance Method Details
#clone ⇒ Object
20
21
22
|
# File 'lib/coque/cmd.rb', line 20
def clone
raise "Not Implemented - Override"
end
|
#get_default_fds ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/coque/cmd.rb', line 24
def get_default_fds
stdin = if self.stdin
self.stdin
else
inr, inw = IO.pipe
inw.close
inr
end
stdoutr, stdoutw = if self.stdout
[self.stdout, self.stdout]
else
IO.pipe
end
[stdin, stdoutr, stdoutw]
end
|
#pipe(other) ⇒ Object
7
8
9
10
11
12
13
14
|
# File 'lib/coque/cmd.rb', line 7
def pipe(other)
case other
when Cmd
Pipeline.new([self.clone, other.clone])
when Pipeline
Pipeline.new([self.clone] + other.commands)
end
end
|
#|(other) ⇒ Object
16
17
18
|
# File 'lib/coque/cmd.rb', line 16
def |(other)
pipe(other)
end
|