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

fix: correctly handling CLI errors again. #2467

Merged
merged 3 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions packages/cli/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ globalTelemetry.initializeInstrumentation()

const oclif = require('@oclif/core')

oclif.run().then(require('@oclif/core/flush')).catch(async error => {
// capture any errors raised by oclif
const cliError = error
cliError.cliRunDuration = globalTelemetry.computeDuration(cliStartTime)
await globalTelemetry.sendTelemetry(cliError)
console.log(`Error: ${error.message}`)
})
oclif.run()
.then(require('@oclif/core/flush'))
.catch(async error => {
// capture any errors raised by oclif
const cliError = error
cliError.cliRunDuration = globalTelemetry.computeDuration(cliStartTime)
await globalTelemetry.sendTelemetry(cliError)

return require('@oclif/core/handle')(error)
ryandagg marked this conversation as resolved.
Show resolved Hide resolved
})

2 changes: 1 addition & 1 deletion packages/cli/src/commands/run/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Command, flags} from '@heroku-cli/command-v9'
import {DynoSizeCompletion, ProcessTypeCompletion} from '@heroku-cli/command/lib/completions'
import {DynoSizeCompletion, ProcessTypeCompletion} from '@heroku-cli/command-v9/lib/completions'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This didn't appear to have any impact, but cleaning up.

import {CliUx} from '@oclif/core-v1'
import '@oclif/core-v1/lib/parser'
import debugFactory from 'debug'
Expand Down
1 change: 1 addition & 0 deletions scripts/postrelease/test_release
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ declare -a COMMANDS=(
"$CMD_BIN regions"
"$CMD_BIN releases --app heroku-cli-test-staging"
"$CMD_BIN run ls -a heroku-cli-test-staging -- --color"
"$CMD_BIN run -x -a heroku-cli-test-staging -- 'bash -c \"exit 2\"'"
"$CMD_BIN run:detached \"echo 'Hello World'\" -a heroku-cli-test-staging"
"$CMD_BIN sessions"
"$CMD_BIN spaces"
Expand Down