42shpimanmls / 42sh

Shell project at 42
3 stars 0 forks source link

Builtin exit #125

Closed n0izn0iz closed 7 years ago

n0izn0iz commented 7 years ago
 ✘ n0iz@nomad  ~/Projects/42sh   builtin_exit  ./42sh
[n0iz@nomad ~/Projects/42sh]$ ./42sh
[n0iz@nomad ~/Projects/42sh]$ exit 42
  executing builtin exit
[n0iz@nomad ~/Projects/42sh]$ exit
  executing builtin exit
 ✘ n0iz@nomad  ~/Projects/42sh   builtin_exit  echo $?
42
n0izn0iz commented 7 years ago

c'est le retour du random travis fail :/ https://travis-ci.org/42shpimanmls/42sh/builds/220715109 a voir après le merge de #118

M5oul commented 7 years ago

Doesn't works on my side.

n0izn0iz commented 7 years ago

What doesn't work @M5oul ??

M5oul commented 7 years ago

Following the example on first post. I don't get 42 at output status.

n0izn0iz commented 7 years ago

Make re? can you post log?

lsimonne commented 7 years ago
➜  42sh git:(builtin_exit) ./42sh
[ChezLouise@ ~/Documents/42/42sh]$ exit foo
  executing builtin exit
➜  42sh git:(builtin_exit) echo $?
0
bash-3.2$ exit foo
exit
bash: exit: kj: numeric argument required
➜  42sh git:(builtin_exit) echo $?
255

sinon chez moi le reste fonctionne

n0izn0iz commented 7 years ago

If n is specified, but its value is not between 0 and 255 inclusively, the exit status is undefined.

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#exit

lsimonne commented 7 years ago

ok! par contre faudra faire les valeurs de retour des commandes en cas d'erreur -> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_02

n0izn0iz commented 7 years ago

yes!

M5oul commented 7 years ago

Ok, it works. I don't know why it didn't works.

n0izn0iz commented 7 years ago
 ✘ n0iz@nomad  ~/Projects/42sh   builtin_exit ●  ./42sh
[n0iz@nomad ~/Projects/42sh]$ ./42sh
[n0iz@nomad ~/Projects/42sh]$ exit 42
  executing builtin exit
[n0iz@nomad ~/Projects/42sh]$ env | grep ?
?=42
[n0iz@nomad ~/Projects/42sh]$ 
n0izn0iz commented 7 years ago
 ✘ n0iz@nomad  ~/Projects/42sh   builtin_exit ●  ./42sh
[n0iz@nomad ~/Projects/42sh]$ ./42sh
[n0iz@nomad ~/Projects/42sh]$ exit 42
  executing builtin exit
[n0iz@nomad ~/Projects/42sh]$ set | grep ?
    executing builtin set
    done executing builtin set, ok
?=42
[n0iz@nomad ~/Projects/42sh]$ 
pilespin commented 7 years ago

command not found must be 127

n0izn0iz commented 7 years ago

ça c'est pas a exit de s'en occuper

lsimonne commented 7 years ago

techniquement, c'est pas un problème d'exit, mais d'exécution (cf mon commentaire au-dessus)

n0izn0iz commented 7 years ago

Yay!