public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eliot Moss <moss@cs.umass.edu>
To: Toyoshima Denis <denis.toyoshima@volvo.com>,
	"cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: Re: Running cygwin from python
Date: Wed, 31 Aug 2022 14:39:59 -0400	[thread overview]
Message-ID: <251df5f2-56b8-0812-c990-a517bd686ec5@cs.umass.edu> (raw)
In-Reply-To: <DB7PR05MB4252EB21D222A73D2AC7B6E9F1789@DB7PR05MB4252.eurprd05.prod.outlook.com>

On 8/31/2022 1:41 PM, Toyoshima Denis wrote:
> Hi there, how are you?
> 
> I’d like to know if there’s any possibility of running simple commands inside Cygwin through Python code.
> If yes, could you provide some examples?

This will happen automatically if you use Cygwin's python.
If you don't, then you have to run a program (for example, ls)
by giving the path to the executable - on my system that is:

C:\cygwin64\bin\ls.exe

Any argument will need to be in a form that the Cygwin program
expects.  For example. to ls my Cygwin home directory, I could
do:

C:\cygwin64\bin\ls.exe /home/moss

I could also do:

C:\cygwin64\bin\ls.exe /cygdrive/c/cygwin64/home/moss


You could also go through two steps, using the cygpath program to
convert paths to the desired form for a Cygwin program to obtain
a Cygwin form name to pass to a Cygwin program.

HTH - Eliot Moss

  parent reply	other threads:[~2022-08-31 18:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31 17:41 Toyoshima Denis
2022-08-31 17:41 ` Toyoshima Denis
2022-08-31 18:39 ` Eliot Moss [this message]
2022-08-31 20:40   ` René Berber
2022-08-31 20:40     ` René Berber
2022-08-31 20:43     ` Eliot Moss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=251df5f2-56b8-0812-c990-a517bd686ec5@cs.umass.edu \
    --to=moss@cs.umass.edu \
    --cc=cygwin@cygwin.com \
    --cc=denis.toyoshima@volvo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).