fix: crash if the id tool fails to run in the container (1660)

This commit is contained in:
ChristopherHX 2023-03-08 15:41:25 +01:00 committed by GitHub
parent aeee2052de
commit f3c88b5091
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -583,7 +583,7 @@ func (cr *containerReference) tryReadID(opt string, cbk func(id int)) common.Exe
} }
exp := regexp.MustCompile(`\d+\n`) exp := regexp.MustCompile(`\d+\n`)
found := exp.FindString(sid) found := exp.FindString(sid)
id, err := strconv.ParseInt(found[:len(found)-1], 10, 32) id, err := strconv.ParseInt(strings.TrimSpace(found), 10, 32)
if err != nil { if err != nil {
return nil return nil
} }

View file

@ -8,6 +8,21 @@ jobs:
image: node:16-buster-slim image: node:16-buster-slim
options: --user node options: --user node
steps: steps:
- name: check permissions of env files
id: test
run: |
echo "USER: $(id -un) expected: node"
[[ "$(id -un)" = "node" ]]
echo "TEST=Value" >> $GITHUB_OUTPUT
shell: bash
- name: check if file command worked
if: steps.test.outputs.test != 'Value'
run: |
echo "steps.test.outputs.test=${{ steps.test.outputs.test || 'missing value!' }}"
exit 1
shell: bash
- uses: actions/hello-world-javascript-action@v1 - uses: actions/hello-world-javascript-action@v1
with: with:
who-to-greet: 'Mona the Octocat' who-to-greet: 'Mona the Octocat'