summaryrefslogtreecommitdiff
path: root/dofile-in-python/all.do
blob: f2367749547750962ede4b2ca8dab8e0329a967e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python3.5
from subprocess import run
from time import sleep

with open('source', 'w') as f:
    f.write('foo')

run(['redo-ifchange', 'target'])

with open('target', 'r') as f:
    target_contents_1 = f.read()

sleep(1)

with open('source', 'w') as f:
    f.write('bar')

run(['redo-ifchange', 'target'])

with open('target', 'r') as f:
    target_contents_2 = f.read()

if target_contents_1 == target_contents_2:
    exit(1)