如何在特定输出/时间后结束 CircleCI 运行 任务

How to end CircleCI run task after specific output / time

我正在使用 CircleCI 和 discord.js。这是我的 config.yml 文件:

version: 2.1
jobs:
  build:
    docker:
      # specify the version you desire here
      - image: circleci/node
      
      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/mongo:3.4.4

    working_directory: ~/5thgradebot

    steps:

      - checkout

      - run:
          name: Install Dependencies
          command: npm install
        
      # run tests!
      - run: npm run start

      - run: circleci-agent step halt

在 运行: npm 运行 开始,运行 开始应该永远 运行,但我不希望它 运行永远在 CircleCI。 运行 任务在看到特定输出后是否有结束任务的方法。例如,“以 DiscordBot#1984 身份登录”

感谢@halfer 的回答:

假设 npm 运行 start 是您要限制的命令,请尝试 timeout 5m npm 运行 start,持续 5 分钟。使用 timeout --help 作为您的时间选项。