koalaman/shellcheck

SC2033: timeout (POSIX.1-2024) is not checked

Closed this issue · 0 comments

For bugs

  • Rule Id (if any, e.g. SC1000): SC2032, SC2033
  • My shellcheck version (shellcheck --version or 'online'): online
  • I tried on shellcheck.net and verified that this is still a problem on the latest commit
  • It's not reproducible on shellcheck.net, but I think that's because it's an OS, configuration or encoding issue

For new checks and feature suggestions

Here's a snippet or screenshot that shows the problem:

#!/bin/sh
foo() { ps -p $$; }
timeout 10 foo
# screen foo  # SC2033

Here's what shellcheck currently says:

Nothing.

Here's what I wanted or expected to see:


Line 2:
foo() { ps -p $$; }
^-- SC2032 (info): This function can't be invoked via screen on line 3.
 
Line 3:
timeout 10 foo
           ^-- SC2033 (warning): Shell functions can't be passed to external commands. Use separate script or sh -c.

timeout is now a POSIX utility, but is not checked like screen.