Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using _append line with rc.eos breaks rc.eos #311

Open
phil-dileo opened this issue Apr 21, 2015 · 0 comments
Open

Using _append line with rc.eos breaks rc.eos #311

phil-dileo opened this issue Apr 21, 2015 · 0 comments

Comments

@phil-dileo
Copy link
Contributor

If you are the first to write to rc.eos then you want #!/bin/bash as the first line, but with the current code

    def append_rc_eos_lines(self, lines):
        '''Add lines to rc.eos.
        Args:
            lines (list): List of bash commands
        '''
        if not self._has_rc_eos():
            lines = ['#!/bin/bash'] + lines
        self._append_lines(RC_EOS, lines)
    def _append_lines(self, filename, lines):
        with open(filename, 'a') as output:
            output.write('\n')
            output.write('\n'.join(lines))

There will always be a newline as the first line in rc.eos. This breaks the shell script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant