From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2AFEC43F47; Mon, 29 Apr 2024 17:18:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ED769402A3; Mon, 29 Apr 2024 17:18:20 +0200 (CEST) Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by mails.dpdk.org (Postfix) with ESMTP id E8E644029C for ; Mon, 29 Apr 2024 17:18:18 +0200 (CEST) Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-2b24dbd1bb6so203384a91.3 for ; Mon, 29 Apr 2024 08:18:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1714403898; x=1715008698; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=pikxG0acylD8HJrvYLsMmXDh33p2SVdwzB4DNE8indg=; b=KEq2QNSML2DwXi4hs+SDue3/Ootyp/6kxqA0XiV30mSqAnWQ/TahxXLrH7FTzmqQ9T zZWyUC98uChst8KidOxVkSRny/8szzaoKNhbXFs/Wd2i6eFG1H05yWd/jZzoiiOeQo7j hUS+VQgPzbFFbasS1x0MXH4fky4cuFfdGn4SE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714403898; x=1715008698; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pikxG0acylD8HJrvYLsMmXDh33p2SVdwzB4DNE8indg=; b=QAW8Z6CCxFYJrEwDw/j/vhn28A9DpYwQ9ec8w6LONbS+pU5Ana856L+aLrwKpP77ZG mHQDCzfNmJt+hPD5TPQGUBzTRaCzDDE5tUXr1mMGO2VQsH5cKuH62Sxnp7Udfw8EsphV tpTy85I43xSFQjw+g+9qZWSI3YQ/CwsypCJPkShm/FwsNGW3JI7MXExsqBhgQFRDJ3We Wo2eGE7lQSK/q7xzQhrtQvev/1dQEMKYac8VD4q3zsblhB4wJ945KmVSnVtT9Z0hSQMq VqY2EgR+7q70EzEZx53tr4olTemhdoiDQYre3QDUX0PTREQfKD/G0jx2T2Elj743CwY3 cZtw== X-Forwarded-Encrypted: i=1; AJvYcCV2Oz/BipvGrBsItOknM4gMeAUdXQRFMk5V1jLSF/Uf6CDIt39AVri06qiij14yivtVn5XgAB/X83Afd+Q= X-Gm-Message-State: AOJu0Yyo4b/1xklVrp1syU/enhfUmVnY1YeD26w3ncln+zhPeqE+EUU0 W7LSW+JeuPIAO4NLJFHvhWDeyfIuaGgCQTLdEk/7N9ZW8HVwNb2999v5yy1a71rwL29yKdQj09E 3kqxOdagl7BNwOOG4HwR2SYK1fJdVkbzLNlWuSQ== X-Google-Smtp-Source: AGHT+IGiJ64HmJkIXSiNSBnVjyYf7dLT43K6Q5okI+iXJ1VCHa24rjIxwv09/Tvtk1pMacctljF1rLXKGsQixiWkDas= X-Received: by 2002:a17:90a:1056:b0:2a9:f3d1:c0db with SMTP id y22-20020a17090a105600b002a9f3d1c0dbmr9855650pjd.24.1714403897866; Mon, 29 Apr 2024 08:18:17 -0700 (PDT) MIME-Version: 1.0 References: <20240412111136.3470304-1-luca.vizzarro@arm.com> <20240412111136.3470304-3-luca.vizzarro@arm.com> <743fd932-1192-42ac-ab5b-27ac5b7e56ed@arm.com> In-Reply-To: From: Jeremy Spewock Date: Mon, 29 Apr 2024 11:18:06 -0400 Message-ID: Subject: Re: [PATCH 2/5] dts: skip first line of send_command output To: =?UTF-8?Q?Juraj_Linke=C5=A1?= Cc: Luca Vizzarro , dev@dpdk.org, Paul Szczepanek , Jack Bond-Preston Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Apologies for the complications that this interactive shell provides here. These problems didn't arise previously primarily because the interactive shells were designed to receive commands, give you the raw output, and then the developer extract specifically what they want from the output and ignore the things they don't. I understand however that in your case it might be beneficial to just consume everything. Some of these changes seem universally good and overall not harmful to include (like removing the trailing prompt, I can't really see a use for it) but some others come with caveats, so if it is too complicated this might be better to handle as something testpmd specific, and leave the generic interactive shell to always just give you raw output. On Wed, Apr 17, 2024 at 9:18=E2=80=AFAM Juraj Linke=C5=A1 wrote: > > >> @@ -132,6 +135,9 @@ def send_command(self, command: str, prompt: str= | None =3D None) -> str: > > >> self._stdin.flush() > > >> out: str =3D "" > > >> for line in self._stdout: > > >> + if skip_first_line: > > >> + skip_first_line =3D False > > >> + continue > > > > > > Is there ever a reason to distinguish between the first line and the > > > line with the command on it? > > > > As above, not really sure. Would this always be a command prompt? The Whether this first line is always the command prompt or not is specific to the shell unfortunately. In "bash-like" shells where commands you send are echoed into stdout for easy-of-use for the developer (like testpmd), this first line will always be the command you sent to it. It technically isn't always required for this to happen however, so we could make this assumption, but it could be slightly more limiting down the line. > > doubt arises only because I don't understand why we'd need the command > > prompt fed back. > > > > The only thing I could think of is debugging. Maybe it could offer > some extra insight in some corner cases. I agree that it is useful for debugging, but we do also log it separately before sending the command. I don't think the command could change by simply being sent into the shell unless something strange happens like the shell breaks it across multiple lines. I think it would be fine to exclude it, but as mentioned, it isn't always safe to do so. > > > > > > >> if prompt in line and not line.rstrip().endswith( > > >> command.rstrip() > > >> ): # ignore line that sent command > > >> -- > > >> 2.34.1 > > >> > >