1
0
mirror of https://github.com/sstephenson/bats.git synced 2024-12-25 14:09:43 +01:00

Fix backtrace sed script for non-GNU seds

Tested on GNU `sed --posix`.

From `info sed`:
`\+'
     As `*', but matches one or more.  It is a GNU extension.

`\CHAR'
     Matches CHAR, where CHAR is one of `$', `*', `.', `[', `\', or `^'.
     Note that the only C-like backslash sequences that you can
     portably assume to be interpreted are `\n' and `\\'; in particular
     `\t' is not portable, and matches a `t' under most implementations
     of `sed', rather than a tab character.
This commit is contained in:
Andrey Mazo 2014-06-29 00:25:56 +04:00
parent bbaf0f50df
commit 03c6ab4c0f

View File

@ -153,7 +153,7 @@ bats_print_stack_trace() {
# inspired by Gentoo Portage die()
failed_cmd="$(sed \
-e "${failed_cmd_line}!d" \
-e "${failed_cmd_line}s:^[ \t]\+::" \
-e "${failed_cmd_line}s:^[ ][ ]*::" \
-e "${failed_cmd_line}q" \
"${failed_cmd_filename}")"
echo "# \`${failed_cmd}' failed"