pharo-project / pharo-launcher

Lets you manage your pharo images and download new ones
https://pharo-project.github.io/pharo-launcher/
MIT License
108 stars 46 forks source link

replaced dummy command for unit test launch command #605

Closed Bajger closed 1 year ago

Bajger commented 1 year ago

replaced dummy command to work with posix_spawnp ffi call

Bajger commented 1 year ago

Folowing unit test failed randomly: image

Root cause by failing ffi call: image

Rationale for change:

so `cd` command might fail, whenever invoked from posix_spawnp() ?

Yes, invoking the cd command from the posix_spawnp() function is likely to fail, because cd is a shell built-in command, not an external executable file.

When you execute a shell command like cd from the command line, the shell itself interprets the command and changes its own current working directory accordingly. However, when you try to execute cd using the posix_spawnp() function, the operating system will attempt to find an executable file named cd, which doesn't exist, and the function will fail.

So `echo` command is a standard Unix utility, but on the other hand `cd` is not a standard Unix utility that shoudn't be used in posix_spawnp() function?

Yes, that's correct. echo is a standard Unix utility that is typically available on most Unix-like operating systems, including Linux and macOS.

On the other hand, cd is not an external executable command, but rather a built-in command of most Unix shells, including the Bash shell. Because cd is not an external executable, it cannot be executed by the posix_spawnp() function. If you attempt to execute cd using posix_spawnp(), the function will likely fail with an error.

Instead of using cd in your posix_spawnp() function, you can use other external executables that are guaranteed to be available on the target operating system, such as echo or ls, to test your code. These commands can be executed using posix_spawnp() just like any other external executable.