fix: keep process type resolvable with heroku run --exit-code#3804
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
heroku run --exit-code <process-type>failing withcommand not found(exit 127). When--exit-codewas set, the CLI appended; echo …directly onto the command (web→web;), so the runtime's first-token lookup no longer matched a declared process type and ran the name literally in a shell. Adding a space before the;keeps the first whitespace-delimited token bare so the runtime resolves it against the app's Procfile/formation.Dyno._doStartto emit<command> ; echo …instead of<command>; echo …._doStartunit tests covering single-token process types, multi-arg commands, and the no---exit-codepath.Type of Change
Note: Add a
!after your change type to denote a breaking change.Verification
Automated:
npx mocha --forbid-only "test/unit/lib/run/dyno.unit.test.ts" npx eslint src/lib/run/dyno.ts test/unit/lib/run/dyno.unit.test.tsManual (against a real app with a
webprocess type):npm run build # oclif runs from ./dist, so rebuild before exercising the CLI ./bin/run run --exit-code web -a example-http-proxybash: web: command not found, exit code 127.node mcp-auth-proxy/index.js), and the CLI passes through the app's real exit code instead of 127.Additional Context
Root cause is server-side resolution: the runtime looks up a process type by the first whitespace-delimited token of the command (
app.process_types.find_by(name: normalized_command.split(/\s+/).first)), then substitutes the real command while keeping trailing args.web;matched nothing, sowebran verbatim. The one-character fix (space before;) keeps the tokenweband leaves; echo …as trailing shell, preserving exit-code propagation. The change flows throughrun,run:inside, andrake, which all route throughDyno.Reproduction:
heroku run web→ works.heroku run --exit-code web→ expected: process type runs and its exit code is returned; actual (before fix):command not found, exit 127.Related Issue
Closes #1227