Open beanieboi opened 8 years ago
We did fix a bug with the parser that it looks like you were trying to get
around with those escapes. Maybe just change it to heroku run --exit-code --app test-access-app -- bash -c "exit 53"
?
On Mon, May 23, 2016 at 5:34 PM Benjamin Fritsch notifications@github.com wrote:
hey,
we run a few integration tests against the Heroku Toolbelt to test some of our code. last week this code ran fine and returned and exit code of 53. somewhere between this week and last week this command broke.
/usr/bin/heroku run --exit-code --app test-access-app -- bash -c \'exit 53\' Running bash -c \'exit 53\' on ⬢ test-access-app... starting, run.4769 Running bash -c \'exit 53\' on ⬢ test-access-app... connecting, run.4769 Running bash -c \'exit 53\' on ⬢ test-access-app... up, run.4769 53': -c: line 0: unexpected EOF while looking for matching `'' 53': -c: line 1: syntax error: unexpected end of file ▸ Process exited with code 1
expected output ▸ Process exited with code 53 and no error message.
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/heroku/heroku/issues/1956
hey jeff, nice meeting you!
sorry for being so short worded when i opened the issue. it was late yesterday and i wanted to document it somewhere :)
we have a wrapper script on our Codeship platform that people use, this is mostly to abstract the location of the heroku toolbelt away from the user. we can totally discuss if this was a good idea (i personally think it was not :) but we have this thing in place.
heroku_run.sh
#!/bin/bash
ARGS=${@:1:$#-1}
APP_NAME=${@: -1}
/usr/bin/heroku run --exit-code --app ${APP_NAME} -- ${ARGS}
we have a test in place that actually checks for return codes from the Heroku Toolbelt since return codes a very very critical to our platform. if we continue a deployment or stop the whole deployment pipeline.
our test looks like this
heroku_run "bash -c 'exit 53'" test-access-app || echo $? | grep 53
i tried "all" possibilities of escaping the command differently but all ended up being weirdly interpreted from the Heroku Toolbelt. i disabled the test for now but would to enable it again.
what exactly did you change to the parser? from looking into the commits i couldn't find something obvious that changed. (but i'm not familiar with the Toolbelt code at all)
thanks for your time! i would love to help moving this forward. but first i fully want to understand the changes you made :)
@beanieboi @dickeyxxx is on vacation right now, so I can try and help you now. The heroku run command will try and escape the args to your command unless the args size is one. See https://github.com/heroku/heroku-run/blob/master/lib/helpers.js#L7 . So what is happening is that the quotes around exit 53 are getting escaped because they are seen as separate arguments with single quotes in them. I am absolutely awful at bash scripting, and am not sure how to make this work in bash, but here is a ruby script that works which hopefully is helpful in some way. Please let me know if this does not help.
#!/usr/bin/env ruby
APP_NAME=ARGV.pop
command = ["heroku", "run", "--exit-code", "--app", APP_NAME, "--"] + ARGV
exec(*command)
> % ./heroku_run.rb bash -c 'exit 53' thawing-temple-8799
Running bash -c exit\ 53 on ⬢ thawing-temple-8799... up, run.8716
▸ Process exited with code 53
rbriggs@ebriggs-ltm [10:23:22] [~/git/ruby-getting-started] [master *]
-> % echo $?
53
@beanieboi I am guessing this is what broke things, we had a bug where double quotes were not interpreted properly so we started using a library to escape the args https://github.com/heroku/heroku-run/pull/10
@beanieboi I just shipped a release backing out the change that broke your script, could you please heroku update
and try again?
@ransombriggs perfect, getting ▸ Process exited with code 53
. thank you so much!
hey,
we run a few integration tests against the Heroku Toolbelt to test some of our code. last week this code ran fine and returned and exit code of 53. somewhere between this week and last week this command broke.
expected output
▸ Process exited with code 53
and no error message.