service where the entire service functionality is in a procedure. ===== Hi! I am trying to declare a simple one-shot operating-system service where the entire service functionality is in a procedure. Following is a minimal reproducible example. The error is `In procedure fport_write: Broken pipe` (see end of message). What is wrong here? I'm new to Scheme and Guix, and it's not very clear to me yet how code staging and g-expressions work, so it's probably something quite obvious. Thanks for looking!
```scm ;; operating-system declaration (use-modules (gnu) (gnu services shepherd) (ice-9 popen)) (use-service-modules networking) (use-package-modules bootloaders) (define (say-hello) #~(let ((port (open-pipe* OPEN_WRITE "logger" "-plocal0.alert"))) (display "========say-hello========\n" port) (close-pipe port))) (define say-hello-service (simple-service 'say-hello-service shepherd-root-service-type (list (shepherd-service (auto-start? #f) (documentation "Say hello.") (one-shot? #t) (provision '(say-hello-service)) (respawn? #f) (start #~(lambda () #$(say-hello))))))) (operating-system (bootloader (bootloader-configuration (bootloader grub-bootloader) (targets '("/dev/vda")) (terminal-inputs '(console serial)) (terminal-outputs '(console serial)) (timeout 1))) (file-systems (cons (file-system (mount-point "/") (device "/dev/vda1") (type "ext4")) %base-file-systems)) (host-name "test-guix-vm") (kernel-arguments (cons "console=ttyS0" %default-kernel-arguments)) (services (append (list say-hello-service) %base-services))) ``` ```sh # Build system image and run with qemu cp $(guix system image --image-type=qcow2 in.scm) image.qcow2 chmod u+w image.qcow2 qemu-system-x86_64 -enable-kvm -m 2048 -device virtio-blk,drive=myhd \ -nographic -drive if=none,file=image.qcow2,id=myhd ``` ```console ## Log in as root and attempt to start service # herd start say-hello-service Starting service say-hello-service... Service say-hello-service failed to start. herd: error: exception caught while executing 'start' on service 'say-hello-service': In procedure fport_write: Broken pipe ```