Skip to content

Commit

Permalink
ensure local run cmd is wrapped in sh -c
Browse files Browse the repository at this point in the history
see https://github.com/Yelp/paasta/issues/124 - both chronos
and marathon wrap the cmd exec'd inside sh -c. replicate this in
paasta local run
  • Loading branch information
Rob-Johnson committed Jan 12, 2016
1 parent e0c0a4f commit 4187bc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion paasta_tools/cli/cmds/local_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def get_docker_run_cmd(memory, random_port, container_name, volumes, env, intera
cmd.append('--detach=true')
cmd.append('%s' % docker_hash)
if command:
cmd.extend(command)
cmd.extend("sh -c '%s'" % command)
return cmd


Expand Down

1 comment on commit 4187bc7

@asottile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will attempt to run 's', 'h', ' ', '-', 'c', ...

You probably want:

cmd.extend(('sh', '-c', command))

Or if command is an array:

cmd.extend((
    'sh', '-c',
    ' '.join(pipes.quote(part) for part in command)
))

Please sign in to comment.