Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. system and FilePath with space (PICCA Frederic-Emmanuel)
2. Re: system and FilePath with space (Frerich Raabe)
3. Re: system and FilePath with space (PICCA Frederic-Emmanuel)
4. Re: system and FilePath with space (Michael Snoyman)
5. Re: system and FilePath with space (PICCA Frederic-Emmanuel)
----------------------------------------------------------------------
Message: 1
Date: Thu, 26 Jan 2017 09:50:47 +0000
From: PICCA Frederic-Emmanuel
<[email protected]>
To: "The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell" <[email protected]>
Subject: [Haskell-beginners] system and FilePath with space
Message-ID:
<a2a20ec3b8560d408356cac2fc148e53bb332...@sun-dag3.synchrotron-soleil.fr>
Content-Type: text/plain; charset="us-ascii"
Hello
I try to execute a command using system.
my code is like this
system (unwords ["python", p])
where
p :: FilePath
p = "/my super/script.py"
has you can see this path contain a space.
When I try to run it I get an error
python: can't open file '/my':
So the system command is wrong.
I understand that I need to escape the space in the command, like this
p = "/my\ super/script.py"
now is there a function in haskell for this.
a sort of sanitizer for FilePath when used by system.
Thanks
Frederic
------------------------------
Message: 2
Date: Thu, 26 Jan 2017 11:03:42 +0100
From: Frerich Raabe <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] system and FilePath with space
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII; format=flowed
On 2017-01-26 10:50, PICCA Frederic-Emmanuel wrote:
> Hello
>
> I try to execute a command using system.
>
> my code is like this
>
>
> system (unwords ["python", p])
An easier way to execute programs is to use the functions defined in
System.Process, e.g.:
import System.Process
main :: IO ()
main = callProcess "/usr/bin/python" ["/my super/script.py"]
Note that 'callProcess' takes a list of strings, each element being one
argument. The elements may contain spaces.
--
Frerich Raabe - [email protected]
www.froglogic.com - Multi-Platform GUI Testing
------------------------------
Message: 3
Date: Thu, 26 Jan 2017 10:19:37 +0000
From: PICCA Frederic-Emmanuel
<[email protected]>
To: "The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell" <[email protected]>
Subject: Re: [Haskell-beginners] system and FilePath with space
Message-ID:
<a2a20ec3b8560d408356cac2fc148e53bb332...@sun-dag3.synchrotron-soleil.fr>
Content-Type: text/plain; charset="us-ascii"
thanks but I do not have a recent enough ghc in order to use this method
(debian jessie)
maybe I can use proc in order to prepare my command line ?
------------------------------
Message: 4
Date: Thu, 26 Jan 2017 12:21:56 +0200
From: Michael Snoyman <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] system and FilePath with space
Message-ID:
<caka2jgk8sq5jdgq+ggnkgpdyrflr17sn1pz3nqczhjx+to+...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
You can use the rawSystem function on older versions of the process package.
On Thu, Jan 26, 2017 at 12:19 PM, PICCA Frederic-Emmanuel <
[email protected]> wrote:
> thanks but I do not have a recent enough ghc in order to use this method
> (debian jessie)
>
>
> maybe I can use proc in order to prepare my command line ?
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20170126/b88ee06a/attachment-0001.html>
------------------------------
Message: 5
Date: Thu, 26 Jan 2017 10:33:27 +0000
From: PICCA Frederic-Emmanuel
<[email protected]>
To: "The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell" <[email protected]>
Subject: Re: [Haskell-beginners] system and FilePath with space
Message-ID:
<a2a20ec3b8560d408356cac2fc148e53bb332...@sun-dag3.synchrotron-soleil.fr>
Content-Type: text/plain; charset="us-ascii"
>You can use the rawSystem function on older versions of the process package.
thanks , it is exactly what I wanted.
Cheers
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 103, Issue 20
******************************************