I have program
(defparameter fconn (run-program "/usr/bin/ftp" '("-n" "192.168.0.1") :pty
t :input t :output t :error t :wait nil))
(force-output (process-pty fconn))
(write-line "user buz pass" (process-pty
fconn))
(force-output (process-pty fconn))
(format t "status => ~a~%" (process-status fconn))
(format t "exit => ~a~%" (process-exit-code fconn))
(sleep 5)
(format t "close => ~a~%" (process-close fconn))
(sleep 5)
(format t "status => ~a~%" (process-status fconn))
(format t "exit => ~a~%" (process-exit-code fconn))
I run the program
* (load "/src/sbcl/test/ftp_status_test")
status => RUNNING
exit => NIL
close => #<PROCESS 3856 :RUNNING>
status => RUNNING
exit => NIL
T
*
During first sleep I check the process
$ ps -ef | grep ftp
buz 3858 5447 0 06:18 pts/9 00:00:00 grep ftp
buz 3856 3350 1 06:18 ? 00:00:00 /usr/bin/ftp -n 192.168.0.1
During second sleep I check the process
$ ps -ef | grep ftp
buz 3860 5447 0 06:18 pts/9 00:00:00 grep ftp
What is the correct way to determine the status of an app launched from
run-program?
Thanks
Richard
|