Skip to content

[SOLVED] Error code 2 while executing in Github Actions #8

@alyonamoskalets

Description

@alyonamoskalets

if stdinStat.Mode() & os.ModeNamedPipe != 0 {*iFilePtr = "-"}

Hello everyone!

Maybe someone will find this information helpful.

I have spent 2.5 days dealing with an issue that did not let me to use this app in Github Actions workflow showing an error (code: 2) and app's help information all the time, before I found the solution. To be clear, I should mention that in my local environments (clear Ubuntu:24.04 container, my own image based on Ubuntu:24.04 and even nektos/act tool) everything worked perfectly.

The problem is that Github Actions workflow executes an environment in such a way somehow that this app thinks there is an input passed already as a pipe or something, so it shows an error. For the app it looks like "-i" flag is passed twice.

Here is my solution:

./hosts-bl -f "hosts" -i "${FILE_NAME}" -compression "9" -hash "256" -from_blackhole "0.0.0.0" -to_blackhole "0.0.0.0" -o "${FILE_NAME_MIN}" < /dev/null

The most important part of this is:
< /dev/null

I do not say that it is the best implementation, but it works now, at least. :)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions