Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

UnhandledPromiseRejectionWarning on macOS #18

Closed
eregon opened this issue Aug 24, 2019 · 4 comments · Fixed by #29
Closed

UnhandledPromiseRejectionWarning on macOS #18

eregon opened this issue Aug 24, 2019 · 4 comments · Fixed by #29
Assignees
Labels
bug Something isn't working

Comments

@eregon
Copy link
Contributor

eregon commented Aug 24, 2019

https://github.com/ruby/spec/pull/683/checks?check_run_id=202172164

Run actions/setup-ruby@v1
  with:
    ruby-version: 2.5.x
do ln -sf /Users/runner/hostedtoolcache/Ruby/2.5.5/x64/bin/ruby /usr/bin/ruby
##[add-path]/Users/runner/hostedtoolcache/Ruby/2.5.5/x64/bin
ln: /usr/bin/ruby: Operation not permitted
(node:825) UnhandledPromiseRejectionWarning: Error: The process 'sudo' failed with exit code 1
    at ExecState._setResult (/Users/runner/runners/2.157.0/work/_actions/actions/setup-ruby/v1/node_modules/@actions/exec/lib/toolrunner.js:547:25)
    at ExecState.CheckComplete (/Users/runner/runners/2.157.0/work/_actions/actions/setup-ruby/v1/node_modules/@actions/exec/lib/toolrunner.js:530:18)
    at ChildProcess.<anonymous> (/Users/runner/runners/2.157.0/work/_actions/actions/setup-ruby/v1/node_modules/@actions/exec/lib/toolrunner.js:430:27)
    at ChildProcess.emit (events.js:200:13)
    at maybeClose (internal/child_process.js:1021:16)
    at Socket.<anonymous> (internal/child_process.js:430:11)
    at Socket.emit (events.js:200:13)
    at Pipe.<anonymous> (net.js:586:12)
(node:825) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:825) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

It seems the ln -sf fails on macOS. The build still works nevertheless.

Actually, what tool requires /usr/bin/ruby to be the same as ruby in PATH?
AFAIK other CIs and all 3 major Ruby managers do not touch /usr/bin/ruby.
I saw

// Ruby / Gem heavily use the '#!/usr/bin/ruby' to find ruby, so this task needs to
// replace that version of ruby so all the correct version of ruby gets selected
// replace the default

but in my experience there is no such problem with RubyGems (as long as gem is on PATH too alongside ruby, but that should always be the case).

I think if such a workaround is needed, it should be done only in those needed cases, not by setup-ruby, what do you think?

@chrishough
Copy link

I am having this same problem, is there a work around?

eregon added a commit to eregon/actions-setup-ruby that referenced this issue Sep 21, 2019
* Fixes actions#18
* The symlink never worked on macOS, and there was a missing `await`.
* No tool should hardcode `/usr/bin/ruby`, but instead executables
  should use `#!/usr/bin/env ruby`.
* If a specific tool needs the symlink, then it can of course be
  added as part of the steps of that CI.
@eregon
Copy link
Contributor Author

eregon commented Sep 21, 2019

PR to fix this in #29

@stephenmichaelf stephenmichaelf removed their assignment Oct 1, 2019
@chrishough
Copy link

Thank you @eregon

dentuzhik pushed a commit to bolteu/setup-ruby that referenced this issue Dec 10, 2019
* Fixes actions#18
* The symlink never worked on macOS, and there was a missing `await`.
* No tool should hardcode `/usr/bin/ruby`, but instead executables
  should use `#!/usr/bin/env ruby`.
* If a specific tool needs the symlink, then it can of course be
  added as part of the steps of that CI.
@bryanmacfarlane bryanmacfarlane self-assigned this Jan 7, 2020
@bryanmacfarlane bryanmacfarlane added the bug Something isn't working label Jan 7, 2020
@eregon
Copy link
Contributor Author

eregon commented Sep 3, 2020

This is still not in @v1 (see #81).
v1 is very old: https://github.com/actions/setup-ruby/tree/v1 = 50f3cc9
Probably v1 should be updated to v1.1.1.

In any case, probably best to use https://github.com/ruby/setup-ruby which is more actively maintained.
cc @alexisbronchart

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants