Quill Notes: Of Channel Transforms and Stdout

So I have a simple enough case. I want Quill to execute a test suite; and sometimes I want to accumulate the output and sometimes I simply want it to be displayed to the console. This is easy enough. To accumulate the result,

    exec {*}$command 2>@1

and to display it to the console

    exec {*}$command >@ stdout 2>@ stderr

The problem arises when I want to do both: let the command write output to the console as it runs, so as to give immediate feedback to the user, but also capture it for later.

If I were always running on Un*x systems, I could add “tee” to the command line; but I can’t assume that on Windows. If I were using [bgexec] I could run the command in the background, listening to the output, and save it and output it. But I’m not using [bgexec], since it isn’t readily available. I could add “tee” as a subcommand to Quill, and include Quill on the command line; which seems overly complicated and fragile.

So I got clever. I wrote a Tcl channel transform that stashes the written data in a variable and returns it unchanged, and pushed it onto the stdout channel. There were some quirks, but I got it working. And then I tried it with the second [exec] command:

exec {*}$command >@ stdout 2>@ stderr

And of course it didn’t work, because the stdout file handle is getting passed to the subprocess running the tests, and the stacked transform only exists in the calling process. D’oh!

Quill Notes: Cross-Platform Builds

For Quill 0.2.0 I made Quill a standalone executable (i.e., a starpack) instead of a starkit, so that it would be independent of the Tcl shell being used by the developer. However, I want to deliver Quill for Windows, Linux, and OSX, and I only have an OSX machine, so I added to Quill the ability to do cross-platform builds.

And I bungled it.

The TclDevKit application “tclapp” has the ability to do cross-platform builds, i.e., to build a Windows starpack on OSX. Given a Windows basekit, it will even go out and pull in any required binary packages from teapot.activestate.com. Very nice.

Now, Quill supports building starkits and starpacks; in Quill 0.1.0, these were reflected in the project file like this:

    app mykit -apptype kit
    app mypack -apptype exe

In order to do cross-platform builds in 0.2.0, I just extended this. To build on Linux, Windows, and OSX, enter this!

    app mypack -apptype {linux windows osx}

Then, ‘kite build’ will always build the starpack for each of the listed platforms.

This is bad on several levels.

First, there’s no way to build just for the current platform. This is annoying at best; and if the current platform isn’t one of the three, it’s a real problem.

Second, there are multiple flavors of each of those operating systems, e.g, 32-bit vs. 64-bit Windows.

Here’s a better approach.

First, the “-apptype” option in the project file goes back to two values: “kit” and “exe”.

Second, the “kite build” command always builds “exe” apps for the current platform, whatever it is.

A new “kite build all” command will build everything for the current platform: run tests, format documentation, build library .zip files and executables, and build distribution .zip files.

For projects with an app with “-apptype exe”, a “dist” name can include “%platform” to include the current platform in the name of the distribution .zip file.

So, to build the distribution .zip for this platform (OSX):

   kite build all

Then to build the application and distribution .zip for a specific platform:

   kite build app -platform platform

And there we go.

Quill Notes: Fixing up the Teapot Configuration on Linux

You can find Quill at the tcl-quill GitHub page.

Yesterday, with help from my friend Ted Brunzie I got Ubuntu Linux (64-bit “Trusty Tahr”) running in a virtual machine on my iMac. That means I can actually do Quill testing on 64-bit Linux, which is outstanding.

So far I’ve discovered the following things:

quill teapot create‘ and ‘quill teapot link‘ don’t work right. This isn’t Quill’s fault precisely. Given a typical installation of ActiveTcl on Linux, certain files go in disk partitions owned by “root”. Quill can’t touch these without superuser privileges, which means that certain commands need to be run using ‘sudo‘.

The problem is that the platform’s security policy affects how ‘sudo‘ behaves. On some Linux boxes I’ve used, the command ‘sudo quill teacup link‘ works just fine. On others, Quill can’t see the user’s PATH (which it needs to find the ‘teacup‘ executable) and so it fails. On some of these, if you do ‘sudo -E quill teacup link‘ to preserve the environment, everything works fine.

And as I’ve just discovered, on others even the “-E” flag doesn’t help.

I’ve got a scheme for how to handle that; more on it later.

64-bit vs. 32-bit matters. The ‘quill build‘ command doesn’t make any distinction between 32-bit and 64-bit Linux, except when building a Linux executable on some other platform; and then it assumes you want 32-bit. But this Ubuntu installation is 64-bit; and it doesn’t include all the libraries needed for 32-bit TCL/TK GUI applications. Thus, you might well want to build both 32-bit and 64-bit Linux executables, and the platform you’re actually on matters in ways that hadn’t occurred to me. I’ll be looking into fixing that as well.

Cry ‘Woof!’

And here’s the big news: starting today, I’ll be blogging over at the Catholic Channel at Patheos, at my new blog: “Cry ‘Woof!’ and let slip the dogs of whimsy“.

The blog title is a Dominican thing; go see my welcome post for more on that.

The Foothills aren’t going away…but on the other hand, I’m not likely to be blogging here much— so point your feed reader at “Cry ‘Woof!’” if you don’t want to miss anything. There are multiple subscription methods at the new blog.

There Will Be News

Things are going to be changing around here. Got a couple of days to go, yet, and then….WOOSH!

We are Saved, We are Being Saved, We will be Saved

If you’re Catholic, and you’ve ever been asked, “Are you saved?”, Aggie Catholics has you covered.

This may be the best short explanation I’ve seen of the difference between the Catholic understanding of salvation and the Evangelical Protestant understanding.

Field Hospital

In his recent interview with America Magazine, Pope Francis suggests that the Church needs to be a field hospital:

“I see clearly,” the pope continues, “that the thing the church needs most today is the ability to heal wounds and to warm the hearts of the faithful; it needs nearness, proximity. I see the church as a field hospital after battle. It is useless to ask a seriously injured person if he has high cholesterol and about the level of his blood sugars! You have to heal his wounds. Then we can talk about everything else. Heal the wounds, heal the wounds….

And our wounds, of course, are the consequences of sin: our own sin, or, heartbreakingly, the sins of others. Christ came to heal those wounds, and he wants to use his body, the Church, to do that.

Now, here’s the thing. I can look at someone, someone I know something about, and say, “Gosh, he has a problem. He needs to fix that. Right now.” And maybe he does: but from where I sit, I don’t know whether I’m seeing high cholesterol or a sucking chest wound. And I don’t know what wounds the person has that I can’t even see.

But Christ sees. And given access, he’ll heal those wounds, and he’ll do the job in priority order, as he sees the priorities.

I know in my life (I may not be representative), Christ seems to deal with one issue at a time. I expect that I’m as sinful as the next guy, but Christ doesn’t seem to bury me under the weight of all my unexamined and unrepented sins all at once. He picks one, or two, and works with me on that. Right now, it seems to be my temper, and keeping my mouth shut when I’d rather give my tongue free rein. There have been others in the past, and will no doubt be others in the future: but I don’t know what those are. Christ, in his mercy, isn’t banging on me about those.

Pope Francis is asking us to extend that mercy to our opponents in the culture wars. Christ loves them. He wants to heal them, too. He’ll give the job as much time as it takes for each individual, and it’s a job that will take the rest of each patient’s life. But they need to come see him and ask him for help.

This is hard for us Catholic bloggers. Good warriors in the Culture Wars, we strive to uphold the truth and defeat falsehood (sometimes too stridently). We so often have a passionate desire to share the truth with the world. If only they could see! But for that, Francis tells us, we need to share the Truth, the Truth Himself, Christ our Lord. It’s His face they need to see.

You Are Loved

When we say, “That is wrong, that is wrong, that is wrong,” people hear, “You are bad, you are bad, you are bad.” When we say, “This is right, this is right, this is right,” people hear, “You are wrong, you are wrong, you are wrong.”

Pope Francis says, “You are loved, you are loved, you are loved.”

Now, we are speaking the truth, and it’s a truth that needs to be heard. But Francis is also speaking the truth, and he is speaking to them.

From Up On Poppy Hill

When Joseph Susanka noted on his blog that the latest from Studio Ghibli, Up On Poppy Hill, was now available in this country on DVD I went forthwith to Amazon and ordered it sight unseen. Tonight we all sat down to watch it, and I can say that it was money well spent.

I’ve been a Hayao Miyazaki fan since I first saw Spirited Away a little over ten years ago—a life time in blog-years. Poppy Hill isn’t precisely a Miyazaki film; or, rather, it is: Hayao Miyazaki worked on the screenplay, but the film was directed by his son Goro Miyazaki film. And I have to say, I can see three significant differences between Poppy Hill and previous Studio Ghibli films I’ve seen.

First, there are no fantastic elements. It’s a tale of young love in a high school in post-war Japan. The couple meet, there’s a snag, you know the drill. Meanwhile, there’s a beloved high school building that’s going to be torn down, and a bunch of hard volunteer labor cleaning it up. There’s a certain amount of goofiness, and fair amount of sweetness, and on the whole I enjoyed the heck out of it. All four of my kids, from the sixteen year-old down to the nine-year-old, were very much engaged, and my older girl’s first words after it ended were, “I want to see that again.”

So it’s a different kind of story than Studio Ghibli usually tells, but it was well done.

Second, the characters in Miyazaki’s movies usually look Caucasian, even when the movie is clearly set in Japan. The characters in Poppy Hill are definitely from the Miyazaki playbook (Umi, the female lead, looks more or less like Nausicca/Kiki with pigtails) but the skintone is different, and the Japanese setting is emphasized.

Third, Miyazaki’s movies are known for being visually stunning. When I sit down to see one for the first time, I know I’ve got a visual treat in store. Poppy Hill, however, sets a new standard for awesome.

It’s sweet, it’s funny, it’s beautiful. Take a look.

Archie Says

Wolfe was in the office looking at television, which gives him a lot of pleasure. I have seen him turn it on as many as eight times in one evening, glare at it from one to three minutes, turn it off, and go back to his book.

— Rex Stout, The Golden Spiders

WordPress Themes