Re: [Haskell-cafe] Strange exit status behavior from the process package
Could I trouble you or anyone else to help me implement this feature? I have some test processes, one that exits cleanly on sigterm and one that refuses and must be killed abruptly. In some experimentation on GHCi, things seem to go alright, but in test, either process reports that it has terminated with 15, which is incorrect. Test code: https://github.com/MichaelXavier/Angel/blob/sigkill/test/Angel/JobSpec.hs#L38 Relevant implementation code: https://github.com/MichaelXavier/Angel/blob/sigkill/src/Angel/Job.hs#L161 https://github.com/MichaelXavier/Angel/blob/sigkill/src/Angel/Process.hs#L40 I've spent quite a bit of time trying different solutions to this and have failed to get the tests to pass. On Sat, Sep 21, 2013 at 9:24 PM, Brandon Allbery allber...@gmail.comwrote: On Sat, Sep 21, 2013 at 11:12 PM, Michael Xavier mich...@michaelxavier.net wrote: I've run into some strangeness with the process package. When you kill some processes on the command line you correctly get a non-zero exit status. However when using the process package's terminateProcess (which sends a SIGTERM), it returns an ExitSuccess: The 143 you get from the shell is synthetic (and nonportable). Signals are not normal exit codes; WEXITSTATUS is not defined in this case (but often will be 0, as seems to be shown here), instead WTERMSIG will be set to the signal that terminated the process. The caller should be using WIFEXITED / WIFSIGNALED / WIFSTOPPED to determine the cause of the termination and then the appropriate WEXITSTATUS / WTERMSIG / WSTOPSIG call to determine the value. It sounds like the createProcess API does not recognize signal exit at all, and uses WEXITSTATUS even when it is not valid. -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -- Michael Xavier http://www.michaelxavier.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Strange exit status behavior from the process package
I've run into some strangeness with the process package. When you kill some processes on the command line you correctly get a non-zero exit status. However when using the process package's terminateProcess (which sends a SIGTERM), it returns an ExitSuccess: module Main (main) where import Control.Concurrent (threadDelay) import System.Process (createProcess, proc, getProcessExitCode, terminateProcess) main :: IO () main = do (_, _, _, ph) - createProcess $ proc /usr/bin/sleep [100] terminateProcess ph threadDelay 100 print = getProcessExitCode ph -- prints Just ExitSuccess, should be Just (ExitFailure 143) term1: sleep 100 term2: pkill sleep term1: echo $? # 143 Anyone know what might be going on? -- Michael Xavier http://www.michaelxavier.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN Vigilance: Get notified when periodical tasks fail to run successfully
Hey Cafe, Just wanted to announce a project I've been tinkering with for a while finally got to a state where I felt comfortable releasing it. Vigilance is a Dead Man's Switch system that notifies you when periodical tasks that fail to check in when you expected them to. An example of this could be registering the daily backups you do of your servers and have them send emails or send HTTP POST requests if backups ever fail to check in. Vigilance provides an executable for doing check-ins and inspecting your watches as well as a simple REST API if you need something embeddable for existing projects. HackageDB: http://hackage.haskell.org/package/vigilance Github: http://github.com/michaelxavier/vigilance Introductory blog post: http://michaelxavier.net/posts/2013-09-17-Announcing-Vigilance-An-Extensible-Dead-Man-s-Switch-System.html -- Michael Xavier http://www.michaelxavier.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Quick Angel User's Survey
Hey Cafe, I am the maintainer of Angel, the process monitoring daemon. Angel's job is to start a configured set of processes and restart them when they go away. I was responding to a ticket and realized that the correct functionality is not obvious in one case, so I figured I'd ask the stakeholders: people who use Angel. From what I know, most people who use Angel are Haskellers so this seemed like the place. When Angel is terminated, it tries to cleanly shut down any processes it is monitoring. It also shuts down processes that it spawned when they are removed from the config and the config is reloaded via the HUP signal. It uses terminateProcess from System.Process which sends a SIGTERM to the program on *nix systems. The trouble is that SIGTERM can be intercepted and a process can still fail to shut down. Currently Angel issues the SIGTERM and hopes for the best. It also cleans pidfiles if there were any, which may send a misleading message. There are a couple of routes I could take: 1. Leave it how it is. Leave it to the user to make sure stubborn processes go away. I don't like this solution so much as it makes Angel harder to reason about from a user's perspective. 2. Send a TERM signal then wait for a certain number of seconds, then send an uninterruptable signal like SIGKILL. There are some caveats with #2. I think I'd prefer the timeout to be configurable per-process. I think I'd also prefer that if no timeout is specified, we assume the user does not want us to use a SIGKILL. SIGKILL can be very dangerous for some processes like databases. I want explicit user permission to do something like this. If Angel generated a pidfile for the process, if it should only be cleaned if Angel can confirm the process is dead. Otherwise they should be left so the user can handle it. So the real question: is the extra burden of an optional configuration flag per process worth this feature? Are my assumptions about path #2 reasonable. Thanks for your feedback! -- Michael Xavier http://www.michaelxavier.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Proposal: New syntax for Haskell
I just want to chime in to defend Cucumber, which I use in Ruby at my day job. I see a lot of people put up the strawman that it can only be used as a way for business people to write acceptance tests. That idea is questionable and I've never worked at a company big enough to require that, or with business people who have ever wanted to write my tests for me. In Ruby, I use Cucumber purely for myself to drive high level acceptance tests for products. I think the sweet spot for it is when you're starting work on a high level feature and you have NO idea how it will be implemented or even how it will work in detail. I find that writing in the limited language that Gherkin provides keeps my brain from going right to implementation details. I write out tests that explore how the system should work. I write them in the perspective of the user (which you should be doing in your head regardless because the user is the one who will actually interact with your program). I then read them back and make sure they make logical sense. Only then do I start hooking up the steps I wrote to code that drives integration/acceptance tests, via a browser for instance. At the end I have a failing cucumber test that describes the system in an intuitive manner with zero line noise (programming language syntax). I am now free to think about implementation details, write lower level unit tests and implement things that can be described in much less verbose fashion. I really like that process and if I ever had a job to develop products in Haskell, I'd probably take a similar approach. Do note that I advocate using Cucumber to create/drive user stories, not to unit test low level functions like folds. If you don't have a customer of a particular function who could describe how they interact with it in layman's term, then Cucumber is the wrong tool. Use quickcheck/hunit/hspec for that. On Thu, Sep 12, 2013 at 3:42 PM, Bob Ippolito b...@redivi.com wrote: Have you tried AppleScript? I wouldn't say it's pleasant to use, but it's easy to read. On Thursday, September 12, 2013, David Thomas wrote: I've long been interested in a scripting language designed to be spoken. Not interested enough to go about making it happen... but the idea is fascinating and possibly useful. On Thu, Sep 12, 2013 at 2:57 PM, Andreas Abel andreas.a...@ifi.lmu.dewrote: ** +1 Cucumber seems to be great if you mainly want to read your code over the telephone, distribute it via national radio broadcast, or dictate it to your secretary or your voice recognition software. You can program thus without having to use you fingers. You can lie on your back on your sofa, close your eyes, and utter your programs... We could have blind Haskell/Cucumber programming contests... Tons of new possiblilities... Strongly support this proposal. ;-) Andreas On 2013-09-10 22:57, Artyom Kazak wrote: On Wed, 11 Sep 2013 00:20:26 +0400, Thiago Negri evoh...@gmail.com wrote: I hope these jokes do not cause people to be afraid to post new ideas. Agreed. I would also like to clarify that my message was much more a joke on the incomprehensibility of legal acts than on the original proposal. By the way, I am pretty impressed with this piece of Cucumber description/code: Scenario: Mislav creates a valid task with an upload When I go to the Awesome Ruby Yahh task list page of the Ruby Rockstars project When I follow + Add Task And I fill in Task title with Ohhh upload And I follow Attachment When I attach the file features/support/sample_files/dragon.jpg to upload_file And I press Add Task And I wait for 1 second And I should see Ohhh upload as a task name I was much more sceptical when I had only seen the example in Niklas’s message. ___ Haskell-Cafe mailing listHaskell-Cafe@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe -- Andreas Abel Du bist der geliebte Mensch. Theoretical Computer Science, University of Munich http://www.tcs.informatik.uni-muenchen.de/~abel/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Michael Xavier http://www.michaelxavier.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: Angel 0.4.4
I'm pleased to announce the release of Angel 0.4.4. angel is a daemon that runs and monitors other processes. It is similar to djb's daemontools or the Ruby project god. It's goals are to keep a set of services running, and to facilitate the easy configuration and restart of those services. New in 0.4.4 * Add env option to config to specify environment variables. * Inject ANGEL_PROCESS_NUMBER environment variable into processes started with count. This is intended for the purpose of logging, port enumeration, etc. Homepage: https://github.com/michaelxavier/angel HackageDB: http://hackage.haskell.org/package/angel -- Michael Xavier http://www.michaelxavier.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: Angel 0.4.2
I'm pleased to announce the release of Angel 0.4.2 and that I have officially taken over maintainership of this project. Thanks to Jamie Turner for starting such a great project and allowing me to take over this project. angel is a daemon that runs and monitors other processes. It is similar to djb's daemontools or the Ruby project god. It's goals are to keep a set of services running, and to facilitate the easy configuration and restart of those services. 0.4.1 added the count option to the config to control the number of instances of a particular process to start. 0.4.2 added the pidfile option to specify the path of a pidfile to generate when monitoring processes. -- Michael Xavier http://www.michaelxavier.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Good XML-Enumerator Examples
Hi Cafe. I'm writing a library which will be parsing XML data from a web API. I'm fairly well versed at this point in parsing JSON (aeson being my library of choice). For XML, I like the API of xml-enumerator over hxt because it appears to be nice and simple .The problem is that the example in the documentation isn't really sufficient for me to get a grasp of how to traverse XML and parse elements with multiple child nodes into a record. My first question: Am I barking up the wrong tree using xml-enumerator for anything beyond fairly flat, basic XML? If not, can anyone direct me to some good code samples using xml-enumerator to parse more complicated data? If I am indeed barking up the wrong tree, what would you all suggest? Thanks, -- Michael Xavier http://www.michaelxavier.net LinkedIn http://www.linkedin.com/pub/michael-xavier/13/b02/a26 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskell Logo
I wondered if anyone knew the legalities of using the haskell logo, in particular, this one: http://media.nokrev.com/junk/haskell-logos/logo1.png on a website, a personal blog in particular. While I am not yet a primarily haskell coder, I'm using it more and more. I find this logo in particular to be quite beautiful and would probably modify it a bit to emphasize the lambda, which has broader application to computer science beyond 1 language. I can't find any information on what the license is for this image. Could anyone offer any advice on this? -- Michael Xavier http://www.michaelxavier.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
I just wanted to echo this a bit. I'm a Ruby on Rails developer in my day job. While I still enjoy ruby, I was very proud that my studies of Haskell helped me identify a problem a week or so ago that would be much more difficult to solve in an imperative language and benefits from laziness. While the role of this tool will be limited compared to what I do day by day, I can finally say that I'm using Haskell at work. If anyone is curious, the project is essentially a service that determines the optimum order for a comparison shopping engine. On Thu, Jun 2, 2011 at 11:52 AM, Yves Parès limestr...@gmail.com wrote: Learning Haskell will pay off much less than learning PHP, if your goal is to find a job. Amen. I cannot agree with this for practical reasons. I'm using Haskell for real world commercial applications, and I'm very productive with it. I wish so much I could say that... Out of curiosity, what are you using Haskell for? 2011/6/2 Ertugrul Soeylemez e...@ertes.de Alberto G. Corona agocor...@gmail.com wrote: Haskell is an academic asset as well as a fun asset. I cannot agree with this for practical reasons. I'm using Haskell for real world commercial applications, and I'm very productive with it. There is however a variation of this statement, with which I could agree, namely: Learning Haskell will pay off much less than learning PHP, if your goal is to find a job. It takes a lot longer and there are a lot less companies in need of Haskell programmers. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife = sex) http://ertes.de/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Michael Xavier http://www.michaelxavier.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell IDE
I use vim (CLI not gvim). Any productivity I lose without the niceties of Leksah are probably made up for with the gains from being a vim user for years. -- Michael Xavier http://www.michaelxavier.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe