Giter Site home page Giter Site logo

Comments (3)

brho avatar brho commented on June 7, 2024

might be similar to what i get. i can get a return of 1 by doing a ctl-c before ctl-d when running bash.

This is with just hitting ctl-d, and i get no error:

$ ./cpu TARGET bash --norc --noprofile
bash-5.1# 
exit

This is with hitting ctl-c, then ctl-d

$ ./cpu TARGET bash --norc --noprofile
bash-5.1# ^C
bash-5.1# 
exit
2022/03/04 16:14:28 CPUD(as remote):exit status 130
2022/03/04 16:14:28 SSH error Process exited with status 1
                                                          $

from cpu.

brho avatar brho commented on June 7, 2024

do you still get this one? i still get my version of it, every time. i can try debugging it too.

from cpu.

brho avatar brho commented on June 7, 2024

ok for my specific thing, that's actually not a bug. the shell actually returns 130, just as the output says. without using cpu at all:

brho@gnomeregan ~/ $ sh
sh-5.1$ 
exit
brho@gnomeregan ~/ $ echo $?
0
brho@gnomeregan ~/ $ sh
sh-5.1$ ^C
sh-5.1$ 
exit
brho@gnomeregan ~/ $ echo $?
130

wtf is 130? that's SIGINT + 128

why is that the return value of sh? (which is bash btw, on my system). because it looks like when bash exits, its exit status is the status of its last command. that's certainly the behavior of bash scripts, and it makes sense they do it for the shell process itself too.

e.g.

brho@gnomeregan ~/ $ sh
sh-5.1$ ls /no-such/file
ls: cannot access '/no-such/file': No such file or directory
sh-5.1$ 
exit
brho@gnomeregan ~/ $ echo $?
2
brho@gnomeregan ~/ $ sh
sh-5.1$ echo no-way > /etc/passwd
sh: /etc/passwd: Permission denied
sh-5.1$ 
exit
brho@gnomeregan ~/ $ echo $?
1
brho@gnomeregan ~/ $ sh
sh-5.1$ ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 Feb 28 12:25 /dev/null
sh-5.1$ 
exit
brho@gnomeregan ~/ $ echo $?
0

also, this looks different than your bug, since you're not using a shell.

anyway, what's the fix? one option would be to ignore all errors that came from shells. perhaps in cpud handler(), isPty case, don't check the error value? though that's less than ideal, since i think that's the cpud --remote command, not the actual shell. btw, at this point, cpud has lost the error code. i.e. instead of 130, it thinks it is '1'. and not only that, but the string "exit status 1"

2022/03/10 12:33:36 wait for /usr/local/bin/cpud -remote -bin cpud -port9p 39175 sh
2022/03/10 12:33:36 cmd exit status 1 returns with /usr/local/bin/cpud -remote -bin cpud -port9p 39175 sh exit status 1
2022/03/10 12:33:36 CPUD:child exited with  exit status 1

that "cmd exit status 1" is "cmd %v", err. i think you might want the args swapped to that printf. (cmd, err, cmd.ProcessState. not err, cmd, cmd.ProcessState)

is there any way to know if we're in a shell inside runRemote()? if not, maybe we need an arg from cpud to cpud --remote, e.g. "--ignore-cmd-error", so we can suppress this.

from cpu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.