8000 clatd command exit code bug · Issue #34 · toreanderson/clatd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

clatd command exit code bug #34

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

Closed
gregbo opened this issue Nov 3, 2023 · 2 comments · Fixed by #35
Closed

clatd command exit code bug #34

gregbo opened this issue Nov 3, 2023 · 2 comments · Fixed by #35

Comments

@gregbo
Copy link
Contributor
gregbo commented Nov 3, 2023

In order to capture the exit code from a system() call, right shift $? by eight bits. Unified diff follows:

--- clatd	2023-11-02 20:49:06
+++ clatd+	2023-11-02 21:10:23
@@ -84,7 +84,7 @@
 #
 # Runs a command. First argument is what subroutine to call to a message if
 # the command doesn't exit successfully, second is the command itself, and
-# any more is the command line arguments.
+# any more are the command line arguments.
 #
 sub cmd {
   my $msgsub = shift;
@@ -98,7 +98,7 @@
     } elsif($? & 127) {
       &{$msgsub}("cmd(@cmd) died with signal ", ($? & 127));
     } else {
-      &{$msgsub}("cmd(@cmd) returned ", ($? >> 127));
+      &{$msgsub}("cmd(@cmd) returned ", ($? >> 8));
     }
   }
   return $?;
@toreanderson
Copy link
Owner

Huh, indeed. Wonder what I was thinking. Would you like to make a merge request with this fix?

@gregbo
Copy link
Contributor Author
gregbo commented Nov 3, 2023

I submitted a pull request with the fix about a half hour ago.

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

Successfully merging a pull request may close this issue.

2 participants
0