Atom complains about functions defined in ~/.bash_profile


i cannot figure out this vexing issue and hope to get some enlightenment from the community. I am on OSX using /bin/bash as my shell. as i use atom, it often throws error regarding a custom function i define in my ~/.bash_profile:

Fetching outdated packages and themes failed.Hide output…
/bin/bash: wrsync: line 1: syntax error: unexpected end of file
/bin/bash: error importing function definition for `wrsync’


and the function in question looks like this (and my bash never complains about it):

# rsync the current folder to remote destination on save
function wrsync() {
  command supervisor -n exit -w . -e '.' -x rsync -- -avzhe ssh . $@ --no-l --exclude=.git/ --exclude=*.pyc --exclude=.DS_Store
export -f wrsync

how can i get more information about the error? it seems this error also gets triggered by python-autocomplete somehow and interrupts its functionality. it has been very frustrating to deal with. Any suggestion would be appreciated!


I am getting essentially the same. Necessary to say, it’s autocomplete-python, who’s complaining about functions defined in ~/.bash_profile


i actually thinks it is more basic to how Atom calls the shell, for example, i also saw this error triggered by script. Here is a solution i found:

basically, you want to launch atom from terminal instead of your macOS launcher. this fixes the problem for me. I am not familiar with macOS application’s launchers but there should be a simple fix.


I actually knew this once, but subsequently forgot it, thank you for reminding me! This is a workaround to those errors.


One thing you might try: change --exclude=*.pyc to --exclude='*.pyc'. If there are any .pyc files in the directory when you invoke that command, the shell will expand *.pyc to a list of those files, which will probably not work if there’s more than one .pyc file. The quotes keep this from happening.


Oh, and $@ should be "$@" to correctly handle spaces in input parameters.


thanks for the suggestions but my .bash_profile actually works fine as is. In fact, i tried commenting/removing all my custom functions to no avail. i think it has something to do with the difference in launching via an initialized shell vs launching via macOS application launcher.