Fork me on GitHub
#circleci
<
2019-09-04
>
borkdude11:09:37

@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?

Marc O'Morain11:09:09

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

Marc O'Morain11:09:12

any error message?

borkdude11:09:22

it just waits

borkdude11:09:55

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

borkdude11:09:37

I can also just use Python:

python -m SimpleHTTPServer 7777

borkdude11:09:42

that does seem to work

borkdude11:09:34

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

Marc O'Morain12:09:42

that’s weird. I have no idea.