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

wait - X isn't a child of this shell process #2115

Open
ale5000-git opened this issue Oct 30, 2024 · 0 comments
Open

wait - X isn't a child of this shell process #2115

ale5000-git opened this issue Oct 30, 2024 · 0 comments

Comments

@ale5000-git
Copy link

ale5000-git commented Oct 30, 2024

Oils 0.23.0 installed with brew install --quiet oils-for-unix.

This code works fine in almost all shells.

Code:

my_func1()
{
  echo 'Sample text'
  return 0
}

my_func2()
{
  echo 'Sample text'
  return 5
}

my_func3()
{
  echo 'Sample text'
  sleep 6
}

my_func_timeout()
{
  local _sec_limit _pid
  _sec_limit=3

  "${1}" &
  _pid="${!}"

  while test "$((_sec_limit = _sec_limit - 1))" -ge 0; do
    sleep 1
    if kill 2> /dev/null -0 "${_pid}"; then
      echo 1>&2 'Still running'
    else
      wait "${_pid}" || return "${?}"
      return '0'
    fi
  done

  kill 1>&2 "${_pid}"
  return 124
}

echo '---'
my_func_timeout 'my_func1'
echo "Return value: ${?}"
echo '---'
my_func_timeout 'my_func2'
echo "Return value: ${?}"
echo '---'
my_func_timeout 'my_func3'
echo "Return value: ${?}"
echo '---'

Instead on Oils it output:

---
Sample text
[%1] PID 3240 Done
        wait "${_pid}" || return "${?}"
             ^
/Users/runner/work/codecov-test/codecov-test/tools/bits-info.sh:32: 3240 isn't a child of this shell
Return value: 127
---
Sample text
[%1] PID 3244 Done
        wait "${_pid}" || return "${?}"
             ^
/Users/runner/work/codecov-test/codecov-test/tools/bits-info.sh:32: 3244 isn't a child of this shell
Return value: 127
---
Sample text
Still running
Still running
Still running
Return value: 124
---
@andychu andychu changed the title wait doesn't work correctly wait - X isn't a child of this shell process Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant