Skip to content

Instantly share code, notes, and snippets.

View shumphrey's full-sized avatar

Steven Humphrey shumphrey

  • Manchester, UK
View GitHub Profile
@shumphrey
shumphrey / keybase.md
Created January 30, 2019 14:06
keybase.md

Keybase proof

I hereby claim:

  • I am shumphrey on github.
  • I am shumphrey (https://keybase.io/shumphrey) on keybase.
  • I have a public key ASC4ghI4xCirqMm7fU2YtXHZJT9Zu4fNxML6v8p42bwnNAo

To claim this, I am signing this object:

This fixes #13551

From perldoc perlobj:

The order in which objects are destroyed during the global destruction
before the program exits is unpredictable. This means that any objects
contained by your object may already have been destroyed. You should
check that a contained object is defined before calling a method on it.

The current version of Test::PostgreSQL uses Moo and stores the File::Temp directory as an attribute. When the File::Temp directory is defined, it uses postmaster stop command. When the directory is undef, it tries to do its own flawed shutdown. During global destruction (when the perl program exits) the order in which things are destroyed is undefined, so the File::Temp directory gets destroyed first hence triggering the alternative postgres shutdown.

@shumphrey
shumphrey / testpostgres.pl
Created April 15, 2016 15:25
Test::PostgreSQL exit failure
#!/usr/bin/env perl
use strict;
use warnings;
use Test::PostgreSQL;
my $pgsql = Test::PostgreSQL->new() or die $Test::PostgreSQL::errstr;
sub run_tests {
## Comment the line below out and Test::PostgreSQL correctly terminates.
@shumphrey
shumphrey / gitserverside_eslint.js
Created February 10, 2016 18:16
Git server side linting
#!/usr/bin/env node
/*
* This script takes a commit and a file
* works out the best eslint config file to use and then runs eslint against
* the file contained within the commit
*
* If the commit contains a local .eslint in yml format, this will be used as
* the config.
* Otherwise a default eslint config needs to be supplied.
@shumphrey
shumphrey / ShellColourPrinter.sh
Created May 11, 2012 13:50
Print out all the colours in a 256 terminal
for code in {000..255}; do print -P -- "$code: %F{$code}Test%f"; done