comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: How to call a Windows executable from Ada?
Date: Thu, 9 Dec 2021 08:29:19 +0100	[thread overview]
Message-ID: <sosb8g$1hb5$1@gioia.aioe.org> (raw)
In-Reply-To: 71f3752c-40a2-4678-9451-1223a776b384n@googlegroups.com

On 2021-12-09 00:04, Marius Amado-Alves wrote:
> Any *effectively working* solution for calling an external Windows executable, with arguments, from inside Ada?
> 
> For example, the following command runs fine when given on the Windows command line:
> 
> "C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE" /f "C:\long path\with spaces\and accented letters\like in the words\declaração de autorização.docx" /mSave_As_Txt
> 
> The same command FAILS when called from inside Ada with any of the know "solutions" on GNAT gem [1] and Rosetta Code [2].

I doubt very much that GNAT.OS_Lib.Non_Blocking_Spawn does not work. You 
do something wrong, like passing quotation marks etc. Remember, Windows 
does not have argument lists Linux have. So all UNIX-esque calls like 
Non_Blocking_Spawn are ultimately assembled back into a single 
command-line which is then split back again inside the process. Thus 
dealing with quotation marks you must make it sure that they are not get 
eaten or introduced.

As for other ways, if you need access to input/output/error of the 
process you can use GLib primitives:

http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm#10

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  parent reply	other threads:[~2021-12-09  7:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-08 23:04 How to call a Windows executable from Ada? Marius Amado-Alves
2021-12-09  5:09 ` Randy Brukardt
2021-12-09  7:26 ` Vadim Godunko
2021-12-09  7:29 ` Dmitry A. Kazakov [this message]
2021-12-09  9:28   ` Marius Amado-Alves
2021-12-09 18:38     ` Dennis Lee Bieber
2021-12-09 19:27     ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox