$stderr  –  STDERR of The Last run Command

$stderr contains the output on STDERR of the last executed run command. This variable is only available if run was executed with --separate-stderr.

Examples

Split output of run into STDOUT and STDERR
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
@test "Example" {
  # enable support for flags of the run command
  bats_require_minimum_version 1.5.0
    
  # keep output on STDERR in $stderr and $stderr_lines
  run --separate-stderr cat nonexistent_filename
  echo "Status: $status" >&3
  echo "Output: $stderr" >&3
  echo "First line: ${stderr_lines[0]}" >&3
}
BashSupport Pro 是一款shell 脚本集成开发环境,支持 bats-core 的 $stderr - 立即试用
© 2020–2024 Joachim Ansorg
声明
隐私政策
许可条款