Lorenzo Mainardi wrote:
dovrei gestire una serie di comandi di sistema e lo vorrei fare
in maniera asincrona.

Se comunichi con i comandi esterni tramite stdin/stdout/stderr (come di solito avviene), puoi usare la relativa feature di gestione del programma "sh":

STDOUT/ERR callbacks <http://amoffat.github.io/sh/#stdout-err-callbacks>

Se non è esattamente quello che ti serve cerca nel resto della doc.

sh è un ottimo strumento per lanciare comandi esterni con una sintassi così semplice che si può usare Python al posto degli shell script, senza allungare il brodo e guadagnando in leggibilità e robustezza.

--
Nicola 'tekNico' Larosa <http://www.tekNico.net/>

You have men who deliberately act sexy like David Bowie or you have
men who are intellectual and sexy like Bob Dylan and there's a whole
range of people in between. It should be the same with women. I don't
see why it has to all be all young girls showing off their bodies.
That doesn't work for some people. - Suzanne Vega, February 2014

_______________________________________________
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python

Rispondere a