fsquillace / junest

The lightweight Arch Linux based distro that runs, without root privileges, on top of any other Linux distro.
GNU General Public License v3.0
2.08k stars 110 forks source link

Fix PATH variable being empty in trapped function #329

Closed soraxas closed 1 year ago

soraxas commented 1 year ago

Commit 9b00c5c4c51c513b09ae32b97a0fbd8ca8590d45 introduced reducing $PATH when executing junest env. However, when the trap function is invoked due to failed command, the $PATH will becomes empty within the context of create wrapper.

Here are what happens before the PR when the trapped create_wrappers function is invoked under a failed status

$ ./bin/junest -- true
$ echo $?
0
$ ./bin/junest -- false
/home/soraxas/junest/lib/core/wrappers.sh: line 23: mkdir: No such file or directory
$ echo $?
127
fsquillace commented 1 year ago

Thanks for raising this! I was also looking at this issue. I updated the PATH in trap https://github.com/fsquillace/junest/commit/daa60b05e3cd4ebf75970ca19bb1a012339dfc8d

fsquillace commented 1 year ago

This should fix the issue. Thanks again.