File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -162,15 +162,32 @@ foo + baz
162162# - Modify the flake
163163# - Re-eval it
164164# - Check that the result has changed
165- replResult=$( (
166- echo " changingThing"
167- sleep 1 # Leave the repl the time to eval 'foo'
165+ mkfifo repl_fifo
166+ nix repl ./flake --experimental-features ' flakes' < repl_fifo > repl_output 2>&1 &
167+ repl_pid=$!
168+ exec 3> repl_fifo # Open fifo for writing
169+ echo " changingThing" >&3
170+ for i in $( seq 1 1000) ; do
171+ if grep -q " beforeChange" repl_output; then
172+ break
173+ fi
174+ cat repl_output
175+ sleep 0.1
176+ done
177+ if [[ " $i " -eq 100 ]]; then
178+ echo " Timed out waiting for beforeChange"
179+ exit 1
180+ fi
181+
168182sed -i ' s/beforeChange/afterChange/' flake/flake.nix
169- echo " :reload"
170- echo " changingThing"
171- ) | nix repl ./flake --experimental-features ' flakes' )
172- echo " $replResult " | grepQuiet -s beforeChange
173- echo " $replResult " | grepQuiet -s afterChange
183+
184+ # Send reload and second command
185+ echo " :reload" >&3
186+ echo " changingThing" >&3
187+ echo " exit" >&3
188+ exec 3>& - # Close fifo
189+ wait $repl_pid # Wait for process to finish
190+ grep -q " afterChange" repl_output
174191
175192# Test recursive printing and formatting
176193# Normal output should print attributes in lexicographical order non-recursively
You can’t perform that action at this time.
0 commit comments