spawn command and pipe