Remote extra record separator from `sh' task action
This commit is contained in:
parent
347e6f80c7
commit
bf25b05adb
@ -19,11 +19,11 @@ Feature: `sh' task action
|
|||||||
target 'some_host.test'
|
target 'some_host.test'
|
||||||
|
|
||||||
task :some_task do
|
task :some_task do
|
||||||
sh '\echo from remote'
|
sh '\echo hello from remote'
|
||||||
end
|
end
|
||||||
"""
|
"""
|
||||||
When I successfully execute the recipe
|
When I successfully execute the recipe
|
||||||
Then the output must contain "from remote"
|
Then the output must contain exactly "hello from remote\n"
|
||||||
|
|
||||||
Scenario: aborts on failed command execution
|
Scenario: aborts on failed command execution
|
||||||
Given a recipe with:
|
Given a recipe with:
|
||||||
|
@ -4,7 +4,6 @@ module Producer
|
|||||||
class ShellCommand < Action
|
class ShellCommand < Action
|
||||||
def apply
|
def apply
|
||||||
remote.execute(arguments.first, output)
|
remote.execute(arguments.first, output)
|
||||||
output.puts
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -12,7 +12,7 @@ module Producer
|
|||||||
|
|
||||||
case program
|
case program
|
||||||
when 'echo'
|
when 'echo'
|
||||||
output << tokens.join(' ')
|
output << tokens.join(' ') << "\n"
|
||||||
when 'true'
|
when 'true'
|
||||||
output << ''
|
output << ''
|
||||||
when 'false'
|
when 'false'
|
||||||
|
@ -15,7 +15,7 @@ module Producer::Core
|
|||||||
sh.apply
|
sh.apply
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'writes the returned output with a record separator' do
|
it 'writes the returned output' do
|
||||||
sh.apply
|
sh.apply
|
||||||
expect(output).to eq "#{command_args}\n"
|
expect(output).to eq "#{command_args}\n"
|
||||||
end
|
end
|
||||||
|
@ -20,8 +20,8 @@ module Producer::Core
|
|||||||
context 'dummy echo command' do
|
context 'dummy echo command' do
|
||||||
let(:command) { 'echo some arguments' }
|
let(:command) { 'echo some arguments' }
|
||||||
|
|
||||||
it 'returns command arguments' do
|
it 'returns command arguments ended by a record separator' do
|
||||||
expect(remote.execute(command)).to eq 'some arguments'
|
expect(remote.execute(command)).to eq "some arguments\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user