circleci 2019-09-04

@marc-omorain I'd like to do this on CircleCI for a unit test:

circleci@f55c318fd0a9:~$ nc -l 4444 &
[3] 486
circleci@f55c318fd0a9:~$ lsof -i:4444
circleci@f55c318fd0a9:~$
Any idea why there is no process listening on port 4444?

not immediately - what does nc -l 4444 do if you run it in the foreground?

any error message?

it just waits

the reason I'd like to do this is that I've made a function wait-for-it which does the same as the famous bash script

I can also just use Python:

python -m SimpleHTTPServer 7777

that does seem to work

weird:

circleci@f55c318fd0a9:~$ nc -l localhost 7777 &
[6] 515
circleci@f55c318fd0a9:~$ nc -z localhost 7777
circleci@f55c318fd0a9:~$ echo $?
1
vs
circleci@f55c318fd0a9:~$ python -m SimpleHTTPServer 7777 &
[7] 517
circleci@f55c318fd0a9:~$ Serving HTTP on 0.0.0.0 port 7777 ...

circleci@f55c318fd0a9:~$ nc -z localhost 7777
circleci@f55c318fd0a9:~$ echo $?
0

that’s weird. I have no idea.