Hi folks,

In src/interp/vmlisp.lisp you have:
#+:sbcl
(defun OBEY (S)
   #-:win32 (if *OBEY-STDOUT*
               (sb-ext::process-exit-code
                (sb-ext::run-program "/bin/sh" (list "-c" S) :input t
                     :output *standard-output* :error *standard-output*))
               (sb-ext::process-exit-code
                (sb-ext::run-program "/bin/sh"
                    (list "-c" S) :input t :output t :error t)))
   #+:win32 (sb-ext::process-exit-code
             (sb-ext::run-program "sh"
                    (list "-c" S) :input t :output t :error t :search t)))

You will remark I added some of your code for notebook support in my
FriCAS copy, here *OBEY-STDOUT*

The ')system' command uses it, but it is also accessible from SPAD via
the OBEY Lisp function instead.

In your jfricas code (webspad.lisp), you have
(defvar webspad-stream (make-string-output-stream))

and use above instead of
:output *standard-output*
:output webspad-stream

And finally use (get-output-stream-string webspad-stream) to return it.
That way you will even use the FriCAS GC.

I guess you will obtain an SExpression that has a 'string' operation
for coercion.

That can even be done in a '.fricas.input' startup file to rewrite the
OBEY LISP function for example.

Cheers,
__
Greg

Le mar. 11 avr. 2023 à 21:01, Ralf Hemmecke <[email protected]> a écrit :
>
> Is there a fricas way that one execute a shell command line (represented
> as String in FriCAS) and capture the output (String with newlines would
> be enough)?
>
> Ralf
>
> --
> You received this message because you are subscribed to the Google Groups 
> "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/fricas-devel/7d99e560-93bd-2c82-9ba4-2c8c67564fe2%40hemmecke.org.

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/CAHnU2dawS9LeAd7joTKZbG%2BJUc1W5bLbw_SzGaJnyEhH7s-q%2Bg%40mail.gmail.com.

Reply via email to