Python 3, 38 bytes
0 or print(0)or exit()
while 1:print(1)
1 or print(0)or exit()
while 1:print(1)
If output to STDERR is allowed (30 bytes):
0 or exit('0')
while 1:print(1)
If output as exit code is allowed (28 bytes):
0 or exit(0)
while 1:print(1)